home *** CD-ROM | disk | FTP | other *** search
/ PC go! 1996 December / PC_GO.ISO / demo / suite96 / lotus008.dsk / LOTCSS.LSS < prev    next >
Text File  |  1995-11-24  |  3KB  |  98 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.support.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.         BrowserPath$=Left$(ReturnedKeyContents$,ReadBytes-1)
  52.         
  53.         ' delete all command line params:
  54.         ExePos=Instr(BrowserPath$,".exe")
  55.         If ExePos<>0 Then
  56.             BrowserPath$=Left$(BrowserPath$,ExePos+4)
  57.         End If
  58.         
  59.         ' return path without leading quote, if there is one:
  60.         QuotePos=Instr(BrowserPath$,Chr$(34))
  61.         If QuotePos<>0 Then
  62.             BrowserPath$=Mid$(BrowserPath$,QuotePos+1)
  63.         End If
  64.         
  65.     Else
  66.         ' found GNN Works
  67.         BrowserPath$ = Left(AppPath$,GNNStat) 
  68.         ' delete all command line params:
  69.         ExePos=Instr(BrowserPath$,".exe")
  70.         If ExePos<>0 Then
  71.             BrowserPath$=Left$(BrowserPath$,ExePos+4)
  72.         End If
  73.         BrowserPath$=BrowserPath$+"\IW.EXE"
  74.     End If
  75.     
  76.     LaunchPath$=BrowserPath$+" "+URL$
  77.     Err=0
  78.     On Error Resume Next
  79.     stat = Shell(LaunchPath$, 1)
  80.     On Error Goto 0
  81.     If Err<>0 Then
  82.         Messagebox "Error launching web browser, please check installation and try again.", MB_OK, "Error"
  83.     End If 
  84. End Sub
  85. Function ReplaceStr (S As String, O As String, R As String) As String
  86. ' S is the input string, O is the old string, R is the replacement string
  87.     If (S = "") Then
  88.         ReplaceStr = ""
  89.     Else
  90.         n = Instr(S,O)
  91.         While (n > 0)
  92.             Mid(S,n) = R
  93.             n = Instr(S,O)    
  94.         Wend
  95.         ReplaceStr = S
  96.     End If
  97. End Function
  98.