home *** CD-ROM | disk | FTP | other *** search
/ PC go! 1996 December / PC_GO.ISO / demo / suite96 / lotus008.dsk / INET.LSS < prev    next >
Text File  |  1995-11-24  |  3KB  |  101 lines

  1. Option Public
  2. Declare Public Function RegOpenKeyExA Lib "advapi32" Alias "RegOpenKeyExA" (Byval HKEY As Long,Byval lpszSubKey As String,Byval dwreserved As Integer,Byval samDesired As Long, keyresult As Long) As Long
  3. Declare Public Function RegQueryValueExA Lib "advapi32" Alias "RegQueryValueExA" (Byval HKEY As Long,Byval lpszValueName As String,Byval dwreserved As Integer, lpdwtype As Long, Byval lpData As String, readbytes As Long) As Long
  4. Declare Public Function RegCloseKey Lib "advapi32" Alias "RegCloseKey" (Byval HKEY As Long) As Long
  5. Declare Public Function GetPrivateProfileStringA Lib "kernel32" Alias "GetPrivateProfileStringA"(Byval AppName As String,Byval KName As Any, Byval Def As String, Byval RStr As String, Byval nSize As Integer, Byval FName As String) As Integer
  6.  
  7.  
  8.  
  9.  
  10. Sub Main
  11.     
  12.     
  13.     Dim happkey As Long
  14.     Dim HKEY_LOCAL_MACHINE As Long
  15.     Dim KEY_READ As Long
  16.     Dim HKEY_CURRENT_USER As Long
  17.     Dim HKEY_CLASSES_ROOT As Long
  18.     Dim ValueType As Long
  19.     Dim ReturnedKeyContents As String * 255
  20.     Dim readbytes As Long
  21.     Dim ReturnString As String * 255
  22.     MaxBytes%=Len(ReturnString$)
  23.     IniFileName$ = "Win.Ini"
  24.     ReturnedKeycontents$=String$(255,Chr$(32))
  25.     
  26.     HKEY_CLASSES_ROOT= &H80000000
  27.     HKEY_CURRENT_USER= &H80000001
  28.     HKEY_LOCAL_MACHINE= &H80000002
  29.     
  30.     KEY_QUERY_VALUE=1
  31.     KEY_ENUMERATE_SUBKEYS=8
  32.     KEY_NOTIFY=16
  33.     KEY_READ=KEY_QUERY_VALUE Or KEY_ENUMERATE_SUBKEYS Or KEY_NOTIFY
  34.     
  35.     KeyName$="http\shell\open\command"
  36.     URL$=" http://www.lotus.com"
  37.     
  38.     GNNStat = GetPrivateProfileStringA("GNNWorks","AppPath","NA",ReturnString$,MaxBytes%,IniFileName$)
  39.     AppPath$=Left$(ReturnString$,GNNStat)
  40.     
  41.     If AppPath$="NA" Then ' did not find 16 bit GNN works
  42.         ValueName$=""
  43.         lstat=RegOpenKeyExA(HKEY_CLASSES_ROOT,KeyName$,0,KEY_READ,happkey)
  44.         ReadBytes=255
  45.         lstat=RegQueryValueExA(happkey,ValueName$,0,valueType, ReturnedKeyContents$,ReadBytes)
  46.         regclosekey(happkey)
  47.         If Trim$(ReturnedKeyContents$)="" Then
  48.             Messagebox("Kein WWW-Browser gefunded, Script adgebrochen.")
  49.             Exit Sub
  50.         End If
  51.         
  52.         BrowserPath$=Left$(ReturnedKeyContents$,ReadBytes-1)
  53.         
  54.         ' delete all command line params:
  55.         ExePos=Instr(BrowserPath$,".exe")
  56.         If ExePos<>0 Then
  57.             BrowserPath$=Left$(BrowserPath$,ExePos+4)
  58.         End If
  59.         
  60.         ' return path without leading quote, if there is one:
  61.         QuotePos=Instr(BrowserPath$,Chr$(34))
  62.         If QuotePos<>0 Then
  63.             BrowserPath$=Mid$(BrowserPath$,QuotePos+1)
  64.         End If
  65.         
  66.     Else
  67.         ' found GNN Works
  68.         BrowserPath$ = Left(AppPath$,GNNStat) 
  69.                ' delete all command line params:
  70.         ExePos=Instr(BrowserPath$,".exe")
  71.         If ExePos<>0 Then
  72.             BrowserPath$=Left$(BrowserPath$,ExePos+4)
  73.         End If
  74.         BrowserPath$=BrowserPath$+"\IW.EXE"
  75.         
  76.     End If
  77.     
  78.     LaunchPath$=BrowserPath$+" "+URL$
  79.     Err=0
  80.     On Error Resume Next
  81.     stat = Shell(LaunchPath$, 1)
  82.     On Error Goto 0
  83.     If Err<>0 Then
  84.         Messagebox "Error launching web browser, please check installation and try again.", MB_OK, "Error"
  85.     End If 
  86. End Sub
  87. Function ReplaceStr (S As String, O As String, R As String) As String
  88. ' S is the input string, O is the old string, R is the replacement string
  89.     If (S = "") Then
  90.         ReplaceStr = ""
  91.     Else
  92.         n = Instr(S,O)
  93.         While (n > 0)
  94.             Mid(S,n) = R
  95.             n = Instr(S,O)    
  96.         Wend
  97.         ReplaceStr = S
  98.     End If
  99. End Function
  100.  
  101.