'VB sample project. Code in the following subroutines
'was added or modified:
' MDIForm_Load
' MDIForm_Resize
' AlignAd
' mnuAdAlign_Click (menus also added)
' mnuAdVisible_Click (menus also added)
' Picture1_Resize (picture box also added)
' theflag (flag used so ad doesn't align on first try)
'Remember not to alter any properties of the AdPipe control
'other than the DeveloperID. You can use the ID 9999 to
'demo AdPipe's functionality, but before distributing your
'application, you should register (for free) for your own
'developer ID so that you can be credited with your user's clicks.
Dim theflag As Integer
Private Sub MDIForm_Load()
'This section of code checks a flag in the registry. If 0,
'the default value, is returned, the flag does not exist, and
'it can be assumed that the user has not run the program before.
'If this is the case, a messagebox will be displayed, and the
'registry flag will be changed so it will not read 0 next time.
'Adjust height and width for different screen resolutions
AdPipea1.Width = 468 * Screen.TwipsPerPixelX
AdPipea1.Height = 60 * Screen.TwipsPerPixelY
If GetSetting("AdPipe", "History", "FirstRun", "0") = "0" Then
longstr = "This programs uses AdPipe advertising to keep it's cost to you at a reasonable level. The next time you're connected to the Internet, it will take a minute or two to download some new ads and contests, but until then you'll see a default image in the advertising space."
MsgBox longstr, vbOKOnly, "Welcome"
SaveSetting "AdPipe", "History", "FirstRun", "1"
End If
theflag = 0
End Sub
Private Sub MDIForm_Unload(Cancel As Integer)
End
End Sub
Private Sub mnuAdAlign_Click()
AlignAd
End Sub
Private Sub mnuAdVisible_Click()
If mnuAdVisible.Checked = True Then
mnuAdVisible.Checked = False
Picture1.Visible = False
mnuAdVisible.Checked = True
Picture1.Visible = True
End If
End Sub
Private Sub mnuClickLine_Click()
frmClickLine.Cls
End Sub
Private Sub mnuDragDrop_Click()
frmDrag.Show
End Sub
Private Sub mnuExit_Click()
End
End Sub
Private Sub mnuInstructions_Click()
' Declare local variables.
Dim MsgText
Dim CR
Dim PB
' Initialize paragraph break local variable.
CR = Chr$(10) & Chr$(13)
PB = Chr$(10) & Chr$(13) & Chr$(10) & Chr$(13)
' Define message text.
MsgText = "Click-A-Line"
MsgText = MsgText & CR & "Click the form several times to draw connecting lines."
MsgText = MsgText & PB & "Scribble"
MsgText = MsgText & CR & "Drag the mouse across the form to draw a line."
MsgText = MsgText & PB & "Drag and Drop"
MsgText = MsgText & CR & "Select a valid text (.txt), bitmap (.bmp), Windows executable (.exe), or Help (.hlp) file in the file list box. Drag the file and drop it into the picture box to display or execute the file."