sunils1
June 15th, 2005, 10:02 AM
Hi,
I want to reference my Dll name from within the DLL itself. I've tried creating a DllMain function so that I can call GetModuleFileName on the HINSTANCE passed into DllMain. The problem is that I don't think that the DllMain function is getting called as if I return FALSE in the function then it still continues to load and run. I'm not sure if my code is correct since this is all quite new to me. Here is the code:
<.cpp file>
BOOL WINAPI DllMain(HINSTANCE hinstDLL,
DWORD fdwReason,
LPVOID lpReserved )
{
// call GetModuleFileName on hinstDLL ...
return TRUE;
}
extern "C" _declspec(dllexport) int dllCallfunction(int IdButton, int MsgHandle, int ToolId)
{
...
}
<.h file>
BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD,LPVOID);
extern "C" _declspec(dllexport) int dllCallfunction(int IdButton, int MsgHandle, int ToolId);
Any suggestions as to what I need to do?
Sunil
I want to reference my Dll name from within the DLL itself. I've tried creating a DllMain function so that I can call GetModuleFileName on the HINSTANCE passed into DllMain. The problem is that I don't think that the DllMain function is getting called as if I return FALSE in the function then it still continues to load and run. I'm not sure if my code is correct since this is all quite new to me. Here is the code:
<.cpp file>
BOOL WINAPI DllMain(HINSTANCE hinstDLL,
DWORD fdwReason,
LPVOID lpReserved )
{
// call GetModuleFileName on hinstDLL ...
return TRUE;
}
extern "C" _declspec(dllexport) int dllCallfunction(int IdButton, int MsgHandle, int ToolId)
{
...
}
<.h file>
BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD,LPVOID);
extern "C" _declspec(dllexport) int dllCallfunction(int IdButton, int MsgHandle, int ToolId);
Any suggestions as to what I need to do?
Sunil