Mixing MFC CDialog with WTL
- I'm working on a project for Windows Mobile that was created using
WTL. But I have to add some preexisting dialogs from another project.
The dialogs are CDialogs made with MFC.
I read a good article, http://www.codeproject.com/wtl/mix_wtl_mfc.asp
, which has helped me compile using the two sets of libraries by
basically not automatically using the WTL namespace. However, when I
run the program I cannot seem to get the dialog to appear.
dlg.DoModal() fails. Here's a look at some of the code. CAboutDlg is
a subclass of CDialog.
CWnd* win = CWnd::FromHandle(m_view.m_hWnd);
I tried again in another project and I got a runtime error doing
something similar. I believe AfxGetResourceHandle() failed somewhere
because the app was not an instance of CWinApp. I'm starting to think
mixing MFC and WTL isn't a very good idea and I should start thinking
about converting everything to WTL.
Any help? Thanks a lot.
- Hi Ron,
> I tried again in another project and I got a runtime error doingIn order to get this to work, at the very least MFC will need valid CWinApp
> something similar. I believe AfxGetResourceHandle() failed somewhere
> because the app was not an instance of CWinApp. I'm starting to think
> mixing MFC and WTL isn't a very good idea and I should start thinking
> about converting everything to WTL.
and mainframe objects, so you will need to make some mods to your core
project to accommodate them. For what it's worth, I've found it far easier
to add WTL code to an MFC project than the other way around. It's generally
pretty easy to convert MFC windowing/dialog code to WTL anyway.
Software/Product Development Consultant,