Currently I have to tell my COM object where the database is located either
1) Hardcoded in the DLL
2) Via my ASP call
How do I retrieve the dir where my DLL is located?
In the VB6 runtime environment "CurDir" does it for the runtime-situation
Once I go "DLL" CurDir is retrieving the current active dir, that could be
anything.
Is a solution present by Microsoft?
== This is Where I want to go to:
I want to create/call something inside the DLL like "thisDLLpath" (read: any
VB instruction doing just that)
When the DLL is located in "c:\myDLLs\testDLL", the call "thisDLLpath"
within the DLL should return just that.
When I move the DLL to "D:\myDLLs\finalLocation" (on another server), the
call "thisDLLpath" within the DLL should return just that
== Why?
When building websites using 3tier, currently I need to set the full path
(or the ODBC name) to the database in either:
1) my ASP script
2) the ODBC manager
Just using the DLL with thisDLLpath enables me to cut away extra settings
and place the DB anywhere. It is less rigid (copy & paste DLL and DB into a
Dir, register the DLL and presto!) Working on two or three different servers
it is the most flexible way to go.
Public Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type
Public Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA"
(ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Public Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias
"RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal
ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long
Public Declare Function RegQueryValue Lib "advapi32.dll" Alias
"RegQueryValueA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal
lpValue As String, lpcbValue As Long) As Long
Public Declare Function RegQueryValueEx Lib "advapi32.dll" Alias
"RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal
lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long
' Note that if you declare the lpData parameter as String, you must pass it
By Value.
Public Declare Function RegSetValue Lib "advapi32.dll" Alias "RegSetValueA"
(ByVal hKey As Long, ByVal lpSubKey As String, ByVal dwType As Long, ByVal
lpData As String, ByVal cbData As Long) As Long
Public Declare Function RegSetValueEx Lib "advapi32.dll" Alias
"RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal
Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long)
As Long ' Note that if you declare the lpData parameter as String,
you must pass it By Value.
Public Declare Function RegDeleteValue Lib "advapi32.dll" Alias
"RegDeleteValueA" (ByVal hKey As Long, ByVal lpValueName As String) As Long
Public Declare Function RegDeleteKey Lib "advapi32.dll" Alias
"RegDeleteKeyA" (ByVal hKey As Long, ByVal lpSubKey As String) As Long
Public Declare Function RegEnumKey Lib "advapi32.dll" Alias "RegEnumKeyA"
(ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpName As String, ByVal
cbName As Long) As Long
Public Declare Function RegEnumKeyEx Lib "advapi32.dll" Alias
"RegEnumKeyExA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpName As
String, lpcbName As Long, ByVal lpReserved As Long, ByVal lpClass As String,
lpcbClass As Long, lpftLastWriteTime As FILETIME) As Long
Public Declare Function RegEnumValue Lib "advapi32.dll" Alias
"RegEnumValueA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal
lpValueName As String, lpcbValueName As Long, ByVal lpReserved As Long,
lpType As Long, lpData As Byte, lpcbData As Long) As Long
First, find the clsid:
iret = RegOpenKey(HKEY_CLASSES_ROOT, Dllname.ClassName & "\CLSID", lHandle)
iret1 = RegQueryValueEx(lHandle, "", o&, 1, ByVal sValuename, lValuename)
Now, find the location:
Running Local:
iret = RegOpenKey(HKEY_CLASSES_ROOT, "CLSID\" & Left$(sValuename, 38) &
"\inprocserver32", lHandle)
DCOM server:
iret = RegOpenKey(HKEY_CLASSES_ROOT, "CLSID\" & Left$(sValuename, 38) &
"\_inprocserver32", lHandle)
sValuename1 = Space$(255)
lValuename1 = 255
iret1 = RegQueryValueEx(lHandle, "", o&, 1, ByVal sValuename1, lValuename1)
Pos = instr(sValuename1, Chr(0))
MyPath = Left$(sValuename1, pos-1)
"Peter Kaptein" <peterk...@hotmail.com> wrote in message
news:403b2a82$0$570$e4fe...@news.xs4all.nl...
I think that's more global variables than in all the VB I've ever done combined.
Doesn't App.Path within the DLL return the path to the DLL?
"Peter Kaptein" <peterk...@hotmail.com> schreef in bericht
news:403b2a82$0$570$e4fe...@news.xs4all.nl...