%REM
extracted from "OLE constants"
(http://www.mondotondo.com/aercolino/noteslog/?p=18)
%END REM
'Install tlbinf32.dll:
Option Public
Option Declare
Use "RegistryAccess"
Sub Initialize
%INCLUDE "error_handling"
Dim tli As Variant
On Error Resume Next
Set tli = CreateObject( "TLI.TLIApplication" )
On Error Goto HandleError
If Err = 0 Then
Set tli = Nothing
Exit Sub
End If
Dim instalar As String
instalar = "tlbinf32.dll"
Dim s As New NotesSession
Dim db As NotesDatabase
Set db = s.CurrentDatabase
Dim d As notesdocument
Set d = GetHelpAboutDocument( db, instalar )
If d Is Nothing Then
Msgbox "The library " & instalar & " has not been installed" & Chr( 10 ) _
& "The library could not be found in the database" & Chr( 10 ) _
& "Please notify your admin"
Exit Sub
End If
Dim systemRoot As String
systemRoot = RegQueryValue( "HKEY_LOCAL_MACHINE", "SOFTWAREMicrosoftWindows NTCurrentVersion", "SystemRoot" )
Dim path As String
path = systemRoot & "system32" & instalar
Call ExtractAttachment( d, instalar, path )
If Dir( path ) = "" Then
Msgbox "The library " & instalar & " has not been installed" & Chr( 10 ) _
& "The library could not be put in the folder " & path & Chr( 10 ) _
& "Please notify your admin"
Exit Sub
End If
If Shell( "regsvr32 /s " & instalar ) <> 33 Then
Msgbox "The library " & instalar & " has not been installed" & Chr( 10 ) _
& "The library could not be registered" & Chr( 10 ) _
& "Please notify your admin"
Exit Sub
End If
Msgbox "The library " & instalar & " has been installed"
' HKEY_CLASSES_ROOTCLSID{8B217746-717D-11CE-AB5B-D41203C10000}InprocServer32
End Sub
Function GetHelpAboutDocument( db As NotesDatabase, filename As String ) As NotesDocument
%INCLUDE "error_handling"
Dim nc As NotesNoteCollection
Set nc = db.CreateNoteCollection( False )
nc.SelectHelpAbout = True
Call nc.BuildCollection
Dim nid As String
nid = nc.GetFirstNoteId
If nid <> "" Then
Set GetHelpAboutDocument = db.GetDocumentByID( nid )
Else
Set GetHelpAboutDocument = Nothing
End If
End Function
------------------------------------------
Source Code
------------------------------------------
<pre class="lotusscript">
%REM
extracted from "OLE constants"
(http://www.mondotondo.com/aercolino/noteslog/?p=18)
%END REM
'Install tlbinf32.dll:
Option Public
Option Declare
Use "RegistryAccess"
Sub Initialize
%INCLUDE "error_handling"
Dim tli As Variant
On Error Resume Next
Set tli = CreateObject( "TLI.TLIApplication" )
On Error Goto HandleError
If Err = 0 Then
Set tli = Nothing
Exit Sub
End If
Dim instalar As String
instalar = "tlbinf32.dll"
Dim s As New NotesSession
Dim db As NotesDatabase
Set db = s.CurrentDatabase
Dim d As notesdocument
Set d = GetHelpAboutDocument( db, instalar )
If d Is Nothing Then
Msgbox "The library " & instalar & " has not been installed" & Chr( 10 ) _
& "The library could not be found in the database" & Chr( 10 ) _
& "Please notify your admin"
Exit Sub
End If
Dim systemRoot As String
systemRoot = RegQueryValue( "HKEY_LOCAL_MACHINE", "SOFTWAREMicrosoftWindows NTCurrentVersion", "SystemRoot" )
Dim path As String
path = systemRoot & "system32" & instalar
Call ExtractAttachment( d, instalar, path )
If Dir( path ) = "" Then
Msgbox "The library " & instalar & " has not been installed" & Chr( 10 ) _
& "The library could not be put in the folder " & path & Chr( 10 ) _
& "Please notify your admin"
Exit Sub
End If
If Shell( "regsvr32 /s " & instalar ) <> 33 Then
Msgbox "The library " & instalar & " has not been installed" & Chr( 10 ) _
& "The library could not be registered" & Chr( 10 ) _
& "Please notify your admin"
Exit Sub
End If
Msgbox "The library " & instalar & " has been installed"
' HKEY_CLASSES_ROOTCLSID{8B217746-717D-11CE-AB5B-D41203C10000}InprocServer32
End Sub
Function GetHelpAboutDocument( db As NotesDatabase, filename As String ) As NotesDocument
%INCLUDE "error_handling"
Dim nc As NotesNoteCollection
Set nc = db.CreateNoteCollection( False )
nc.SelectHelpAbout = True
Call nc.BuildCollection
Dim nid As String
nid = nc.GetFirstNoteId
If nid <> "" Then
Set GetHelpAboutDocument = db.GetDocumentByID( nid )
Else
Set GetHelpAboutDocument = Nothing
End If
End Function
</pre>