عندي مشكله في هذا الكود
المفروض ان الادرس للدي ال ال ما يساوي الصفر اذا كان فايل الدي ال ال موجود لكنه يعطيني قيمة صفر في كل مره. لا اعرف السبب!
الرجاء المساعده وشكرا
#include <windows.h>
#include <iostream.h>
#include <Lmcons.h>
void main()
{
HMODULE hModule;
char dllpath[MAX_PATH];
char modname[] = "mydll.dll";
// even if I put the full path e.g. "c:\\my\\full\\path\\mydll.dll" it doesnt work!
// From DLL name module handle acquisition
hModule = GetModuleHandle(modname);
cout<<"The address of DLL file is: \n"<<hModule<<endl;
if(hModule != NULL)
{
// From module handle full pass of DLL acquisition
GetModuleFileName (hModule, dllpath, sizeof (dllpath));
// Verification message
MessageBox(NULL, dllpath," DLL Path", MB_OK);
}
}