Failed to create CDialog in MFC DLL

Source: Internet
Author: User

1. Problem of module Resources

Add a word before creating a function

Afx_manage_state (AfxGetStaticModuleState ());

Add this sentence, or an error, to see if there is a CWinApp in the DLL. When you add a DLL to MFC, XX.h and XX.cpp that are consistent with the name of the DLL are automatically added, which defines subclasses of the CWinApp. For example, in a module named Dal, there are DAL.h

Class Cdalapp:public CWINAPP
{
Public
Cdalapp ();


Rewrite
Public
Virtual BOOL InitInstance ();
Declare_message_map ()
};


2, CDialog mode display DoModal failure

Afx_manage_state (AfxGetStaticModuleState ());
cdialog_createwellnet* pdialog=new cdialog_createwellnet (pparent);
Pdialog->create (idd_dialog_createwellnet,pparent); Do not create again
Pdialog->domodal ();


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.