Registry Modify
Previous  Top  Next

'This example modifies the virtual registry at runtime so that
' an external ODBC driver can be loaded from the same directory
' where the package EXE is located.

' Get path to package EXE files

Origin = GetEnvironmentVariable("TS_ORIGIN")

' Find last slash in path and grab just the characters before this

LastSlash = InStrRev(Origin, "\")
SourcePath = Left(Origin, LastSlash)

' Form a new path to the ODBC DLL file located outside of the package
DriverPath=SourcePath + "tsodbc32.dll"

' Now modify the virtual registry so that it points to this location, this will cause the application to load the DLL from an external location
Set WSHShell = CreateObject("Wscript.Shell")