home *** CD-ROM | disk | FTP | other *** search
/ CD Shareware Magazine 1996 December / CD_shareware_12-96.iso / WIN / Programa / VBINTRNT.ZIP / VBINTRNT.EXE / VBMOD.BAS < prev    next >
Encoding:
BASIC Source File  |  1996-06-01  |  3.6 KB  |  122 lines

  1. Attribute VB_Name = "vbmod"
  2. 'flag used to determine if surfer started as an
  3. 'add-in or in test mode.
  4.  
  5. Global debugMode As Boolean
  6.  
  7. Global gobjIDEAppInst As Object
  8. #If Win16 Then
  9.     Declare Function OSWritePrivateProfileString% Lib "KERNEL" Alias "WritePrivateProfileString" (ByVal AppName$, ByVal KeyName$, ByVal keydefault$, ByVal FileName$)
  10.     Declare Function OSGetPrivateProfileString% Lib "KERNEL" Alias "GetPrivateProfileString" (ByVal AppName$, ByVal KeyName$, ByVal keydefault$, ByVal ReturnString$, ByVal NumBytes As Integer, ByVal FileName$)
  11. #Else
  12.     Declare Function OSWritePrivateProfileString% Lib "Kernel32" Alias "WritePrivateProfileStringA" (ByVal AppName$, ByVal KeyName$, ByVal keydefault$, ByVal FileName$)
  13.     Declare Function OSGetPrivateProfileString% Lib "Kernel32" Alias "GetPrivateProfileStringA" (ByVal AppName$, ByVal KeyName$, ByVal keydefault$, ByVal ReturnString$, ByVal NumBytes As Integer, ByVal FileName$)
  14. #End If
  15.  
  16.  
  17. Sub CenterForm(Form As Form)
  18.   ' Center the form on the screen.
  19.   Form.Move (Screen.Height - Form.Height) / 2, (Screen.Width - Form.Width) / 2
  20. End Sub
  21.  
  22. Sub doAddInMode()
  23.  
  24. '--------------------------------------------------------------------------
  25. 'this is the startup point for the server
  26. 'it will add the entry to VB.INI if it doesn't already exist
  27. 'so that the add-in is on available next time VB is loaded
  28. '--------------------------------------------------------------------------
  29.  
  30.  
  31.   Dim ReturnString As String
  32.   Dim myClass As String
  33.   
  34.   myClass = "VBWebSurfer3.VBWebClass"
  35.   
  36.   '--- Check to see if we are in the VB.INI File.  If not, Add ourselves to the INI file
  37.   #If Win16 Then
  38.     Section$ = "Add-Ins16"
  39.   #Else
  40.     Section$ = "Add-Ins32"
  41.   #End If
  42.   ReturnString = String$(12, Chr$(0))
  43.   ErrCode = OSGetPrivateProfileString(Section$, myClass, "NotFound", ReturnString, Len(ReturnString) + 1, "VB.INI")
  44.   If Left(ReturnString, ErrCode) = "NotFound" Then
  45.     ErrCode = OSWritePrivateProfileString%(Section$, myClass, "0", "VB.INI")
  46.   End If
  47.  
  48.  
  49. End Sub
  50.  
  51. Sub doTestMode()
  52.  
  53. 'call what the add-in menu would normally call
  54.     
  55.     Debug.Print
  56.     Debug.Print "** Starting In Debug Mode **"
  57.     debugMode = True
  58.     loadPages
  59.     webForm.Show
  60.  
  61. End Sub
  62.  
  63.  
  64. Sub loadPages()
  65.  
  66. Dim URLdb As Database
  67. Dim URLList As Recordset
  68. Dim tabIndex As Integer
  69. Dim path As String
  70.  
  71. Set URLdb = OpenDatabase(App.path & "/" & "URL Database")
  72.  
  73. Set URLList = URLdb.OpenRecordset("URL Query")
  74.  
  75. tabIndex = 1
  76.  
  77. If debugMode Then Debug.Print "Loading URLs"
  78.  
  79. Do Until URLList.EOF
  80.  
  81.     webForm.TabStrip1.Tabs(tabIndex).Caption = URLList.Fields("Friendly Name")
  82.     webForm.TabStrip1.Tabs(tabIndex).Tag = URLList.Fields("Friendly Name")
  83.     If debugMode Then Debug.Print "Location " & URLList.Fields("URL") & " for tab #" & tabIndex; ""
  84.    
  85.     webForm.WebBrowser(tabIndex).Location = (URLList.Fields("URL"))
  86.     splash.message = URLList.Fields("URL")
  87.     DoEvents
  88.     webForm.WebBrowser(tabIndex).Tag = URLList.Fields("Friendly Name")
  89.     webForm.WebBrowser(tabIndex).Visible = True
  90.     tabIndex = tabIndex + 1
  91.     webForm.TabStrip1.Tabs.Add
  92.     Load webForm.WebBrowser(tabIndex)
  93.     URLList.MoveNext
  94. Loop
  95.  
  96. webForm.WebBrowser(1).ZOrder 0
  97. webForm.WebBrowser(tabIndex).Visible = True
  98.  
  99. webForm.TabStrip1.Tabs(tabIndex).Caption = "Go..."
  100.  
  101. End Sub
  102.  
  103.  
  104. Sub Main()
  105.  
  106. 'if a command line flag is set to "debug"
  107. 'then don't do all of the add-in initialization,
  108. 'just display the form to see if the web form
  109. 'works. Otherwise, do the normal stuff
  110. 'necessary to connect the add-in
  111.  
  112. debugMode = False
  113.  
  114. If Command$ = "debug" Then
  115.     doTestMode
  116.   Else
  117.     doAddInMode
  118. End If
  119.  
  120. End Sub
  121.  
  122.