المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Re: DDE in MFC



C++ Programming
11-19-2009, 02:50 PM
Hello all,
I am using Visual Studio 2008, and I created a new MDI application. In the setup of the application, I chose a file extension to use. In InitInstance of the class derived from CWinApp, I added this code as the first line of the function:
AfxMessageBox("InitInstance");
Also, in the class derived from CWinApp, I added as the first line of the function OnDDECommand:
AfxMessageBox("OnDDECommand");
When I run this program from the IDE, everything appears to be fine. However, when I run this from Windows explorer and double-click on the appropriate file (a file with the extension my program uses), I see the message: "Windows cannot find 'E:\Mikea Documents\mdi41.mdi4'. Make sure you typed the name correctly, and then try again. To search for a file, click the Start button, and then click Search." I also saw the InitInstance message as was expected, but I didn't see any GUI, nor did I see any OnDDECommand message. The application remains open. Now, if I double-click on the file again, I see the OnDDECommand message and the GUI, but I didn't see the InitInstance message. The application now closes.

I have looked at different places on the internet to try to figure out why this is happening, but I haven't gotten anywhere. Does anyone have any ideas?

Regards,
Mike