I have problem in using CFileDialog:oModal() function in DLL.
I have no trouble in doing such function call in EXE application. Also, I have no trouble to show CColorDialog and my own dialog by using "DoModal()" functions.
To show your the issue more clearly, I attach a solution which includes 3 projects as shown below
1. The "DLL_Caller" project is to call the DLL "DLLTest.dll".
2. The "DLLTest" project is to create the DLL.
3. The "DLLTest_EXE" project has the same code as the "DLLTest" project, but a EXE version.
My development enviroment is Visual Studio2008 SP1.
I have problem in using CFileDialog:oModal() function in DLL.
What exactly is the problem you are experiencing? You don't say what is the problem.
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
What exactly is the problem you are experiencing? You don't say what is the problem.
Thank you for your quick reply.
My problem is the application hangs in the CFileDialog:oModal() call in the DLL mode. The file open/save dialog doesn't show at all. The function runs fine in the EXE application.
The problem happens in CFileDialog only. The CColorDialog:oModal() function works. I'm talking about in MFC DLL (no matter it is a Extension DLL or not).
In the "MFC Application" mode, everything is working properly.
> DLLTest.dll!CDLLTestApp::InitInstance() Line 66 C++
DLLTest.dll!InternalDllMain(HINSTANCE__ * hInstance, unsigned long dwReason, void * __formal) Line 100 + 0x13 bytes C++
DLLTest.dll!DllMain(HINSTANCE__ * hInstance, unsigned long dwReason, void * lpReserved) Line 272 C++
DLLTest.dll!__DllMainCRTStartup(void * hDllHandle, unsigned long dwReason, void * lpreserved) Line 512 + 0x11 bytes C
DLLTest.dll!_DllMainCRTStartup(void * hDllHandle, unsigned long dwReason, void * lpreserved) Line 476 + 0x11 bytes C
You must not block DllMain, never do that. Your another code with running the dialog from EntryFunction works with file dialog just perfect.
Last edited by Igor Vartanov; May 22nd, 2013 at 01:53 AM.
> DLLTest.dll!CDLLTestApp::InitInstance() Line 66 C++
DLLTest.dll!InternalDllMain(HINSTANCE__ * hInstance, unsigned long dwReason, void * __formal) Line 100 + 0x13 bytes C++
DLLTest.dll!DllMain(HINSTANCE__ * hInstance, unsigned long dwReason, void * lpReserved) Line 272 C++
DLLTest.dll!__DllMainCRTStartup(void * hDllHandle, unsigned long dwReason, void * lpreserved) Line 512 + 0x11 bytes C
DLLTest.dll!_DllMainCRTStartup(void * hDllHandle, unsigned long dwReason, void * lpreserved) Line 476 + 0x11 bytes C
You must not block DllMain, never do that. Your another code with running the dialog from EntryFunction works with file dialog just perfect.
Thank you for your work!
Now I see what is the problem. I made change. It is working.
Best regards,
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.