Greetings!
 
I have an ActiveX DLL written in MS Visual C++ 6, and accessed by an
application written in C#.  When the AxDLL is first accessed, it tries
to find out what its path is using the following code:
 
 hModule = GetModuleHandle(_T("AnnealHeatModel.dll"));
 ::GetModuleFileName(hModule, szFilePath, _MAX_PATH);
 TmpString = szFilePath;
 
The working directory for the ActiveX DLL is supposed to be the folder
that contains the DLL. 
 
But when I added a statement to write szFilePath to a file, I saw that
it is the path to the executable file (the C# application), not the DLL.
Apparently, the call to GetModuleHandle() fails, hModule is set to NULL,
and passing NULL in to GetModuleFileName() returns the executable's file
name.  I am guessing that the call to GetModuleHandle() fails because
the DLL is not loaded using LoadLibrary(), since it's being called from
a C# application.
 
So what is the correct way to get my DLL's path?  I really don't want to
hard-code it.
 
Thanks very much!
 
RobR
 


[Non-text portions of this message have been removed]

Reply via email to