I have a very old plain Win32 application written in C++ (using the old
forgetton Winmain). No MFC. Now due to some requierments I need to put MFC
code in it. I am on Winxp - VS6 SP5.
So I declared a global variable of CWinapp and continued. I have now winmain
and use MFC as shared DLLs. Everything is fine now and I am only using basic
MFC classes such as CString. But I don't have confidence on this code. I
have some inner feeling that something is wrong or would crash when using
some high level classes.
Can someone please guide me how to integrate MFC in old win32 code. Any
article with steps is heartly welcomed.
Regards
Shrishail
I've done this by creating a dialog-based app using the App-Wizard, then
removing the code from InitInstance, replacing the dialog creation code with
the code in the old WinMain. You might even use another template, SDI or
whatever, depending on the original app. What you want to make sure is that
you assign the m_pMainWnd member - look where it is done originally, and
wrap the HWND of the original app into this.
Now, you can start to add automation support, CStrings and whatnot, to your
hearts contents. You can even add new UI stuff such as dialogs using the
class Wizard, the code will coexist peacefully.
Johan Rosengren
Abstrakt Mekanik AB
"Shrishail Rana" <sr...@hotpop.com> a écrit dans le message de
news:OIyN1Cjz...@tk2msftngp13.phx.gbl...
Thanks for you posting in the group!
Do you have resolved your problem with Johan's advise?
If you have more concern on this topic, please feel free to reply this
message.
Best regards,
Gary Chang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
You could also refer to this MSDN article:
"HOWTO: Add MFC Support to an ATL Project"
http://support.microsoft.com/?id=173974
Though it is used for adding MFC support to an ATL project, you could also
refer to it to see how to add MFC support to your project.
Hope that helps.
Best regards,
Yanhong Huang
Microsoft Community Support
Get Secure! ¨C www.microsoft.com/security