|
-
May 21st, 2010, 06:15 AM
#3
Re: DoModal failed
 Originally Posted by avirat
... Also created one MFC application which uses above created dll and give call to the exported function. Code is as below.
Code:
GetModuleFileName(NULL, szModulePath, MAX_PATH);
GetShortPathName(szModulePath, szModulePath, MAX_PATH);
_tcscat(szModulePath, _T("ADll.dll"));
hAsaeDll = LoadLibrary (szModulePath);
pfnShowAsaeDlg = (PFN_SHOWASAEDLG)GetProcAddress(hAsaeDll, "ShowAsaeDlg");
pfnShowAsaeDlg();
This simple code does not works. DoModal returns -1.
1. While using Windows APIs you must always check their return value:
What does LoadLibrary return?
What does GetProcAddress return? 2. Why do you call GetShortPathName API? Why do you need to convert the full path name of your exe to short (MS DOS) format? 
3. Did you try to debug your code to see the results of all of these APIs and _tcscat calls?
Victor Nijegorodov
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|