Discussion:
old Winmain and CWinApp
(too old to reply)
Shrishail Rana
2003-12-29 17:26:15 UTC
Permalink
Hi

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
Johan Rosengren
2003-12-29 20:40:47 UTC
Permalink
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
Post by Shrishail Rana
Hi
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
Gary Chang
2004-01-02 01:21:27 UTC
Permalink
Hi Shrishail

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.
--------------------
e***@gmail.com
2018-03-20 23:57:53 UTC
Permalink
Hello,

I know this kind of an old post but I'd still like to know the solution on this issue. I am trying to add a ribbon toolbar created on MFC into a WIN32 window. I'd appreciate your help.

Thank you

Yan-Hong Huang[MSFT]
2004-01-02 06:11:50 UTC
Permalink
Hello Shrishail,

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
This posting is provided "AS IS" with no warranties, and confers no rights.
Loading...