home *** CD-ROM | disk | FTP | other *** search
- Attribute VB_Name = "vbmod"
- 'flag used to determine if surfer started as an
- 'add-in or in test mode.
-
- Global debugMode As Boolean
-
- Global gobjIDEAppInst As Object
- #If Win16 Then
- Declare Function OSWritePrivateProfileString% Lib "KERNEL" Alias "WritePrivateProfileString" (ByVal AppName$, ByVal KeyName$, ByVal keydefault$, ByVal FileName$)
- Declare Function OSGetPrivateProfileString% Lib "KERNEL" Alias "GetPrivateProfileString" (ByVal AppName$, ByVal KeyName$, ByVal keydefault$, ByVal ReturnString$, ByVal NumBytes As Integer, ByVal FileName$)
- #Else
- Declare Function OSWritePrivateProfileString% Lib "Kernel32" Alias "WritePrivateProfileStringA" (ByVal AppName$, ByVal KeyName$, ByVal keydefault$, ByVal FileName$)
- Declare Function OSGetPrivateProfileString% Lib "Kernel32" Alias "GetPrivateProfileStringA" (ByVal AppName$, ByVal KeyName$, ByVal keydefault$, ByVal ReturnString$, ByVal NumBytes As Integer, ByVal FileName$)
- #End If
-
-
- Sub CenterForm(Form As Form)
- ' Center the form on the screen.
- Form.Move (Screen.Height - Form.Height) / 2, (Screen.Width - Form.Width) / 2
- End Sub
-
- Sub doAddInMode()
-
- '--------------------------------------------------------------------------
- 'this is the startup point for the server
- 'it will add the entry to VB.INI if it doesn't already exist
- 'so that the add-in is on available next time VB is loaded
- '--------------------------------------------------------------------------
-
-
- Dim ReturnString As String
- Dim myClass As String
-
- myClass = "VBWebSurfer3.VBWebClass"
-
- '--- Check to see if we are in the VB.INI File. If not, Add ourselves to the INI file
- #If Win16 Then
- Section$ = "Add-Ins16"
- #Else
- Section$ = "Add-Ins32"
- #End If
- ReturnString = String$(12, Chr$(0))
- ErrCode = OSGetPrivateProfileString(Section$, myClass, "NotFound", ReturnString, Len(ReturnString) + 1, "VB.INI")
- If Left(ReturnString, ErrCode) = "NotFound" Then
- ErrCode = OSWritePrivateProfileString%(Section$, myClass, "0", "VB.INI")
- End If
-
-
- End Sub
-
- Sub doTestMode()
-
- 'call what the add-in menu would normally call
-
- Debug.Print
- Debug.Print "** Starting In Debug Mode **"
- debugMode = True
- loadPages
- webForm.Show
-
- End Sub
-
-
- Sub loadPages()
-
- Dim URLdb As Database
- Dim URLList As Recordset
- Dim tabIndex As Integer
- Dim path As String
-
- Set URLdb = OpenDatabase(App.path & "/" & "URL Database")
-
- Set URLList = URLdb.OpenRecordset("URL Query")
-
- tabIndex = 1
-
- If debugMode Then Debug.Print "Loading URLs"
-
- Do Until URLList.EOF
-
- webForm.TabStrip1.Tabs(tabIndex).Caption = URLList.Fields("Friendly Name")
- webForm.TabStrip1.Tabs(tabIndex).Tag = URLList.Fields("Friendly Name")
- If debugMode Then Debug.Print "Location " & URLList.Fields("URL") & " for tab #" & tabIndex; ""
-
- webForm.WebBrowser(tabIndex).Location = (URLList.Fields("URL"))
- splash.message = URLList.Fields("URL")
- DoEvents
- webForm.WebBrowser(tabIndex).Tag = URLList.Fields("Friendly Name")
- webForm.WebBrowser(tabIndex).Visible = True
- tabIndex = tabIndex + 1
- webForm.TabStrip1.Tabs.Add
- Load webForm.WebBrowser(tabIndex)
- URLList.MoveNext
- Loop
-
- webForm.WebBrowser(1).ZOrder 0
- webForm.WebBrowser(tabIndex).Visible = True
-
- webForm.TabStrip1.Tabs(tabIndex).Caption = "Go..."
-
- End Sub
-
-
- Sub Main()
-
- 'if a command line flag is set to "debug"
- 'then don't do all of the add-in initialization,
- 'just display the form to see if the web form
- 'works. Otherwise, do the normal stuff
- 'necessary to connect the add-in
-
- debugMode = False
-
- If Command$ = "debug" Then
- doTestMode
- Else
- doAddInMode
- End If
-
- End Sub
-
-