MFC sets the class, which will be called the C [your application name] App (for example, CExampleApp) to [your application name] .h / .cpp (for example, Example.h / .cpp). Here you will have a function called "InitInstance" (MFC is automatically generated again). If you created a dialogue-based application, you will have some code that looks like this:
CExampleDlg dlg;
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
In particular, calling "dlg.DoModal ()" will call up your dialog box. If you avoid this, the GUI will never start.
If you use the MDI application, you will have the following code:
CMainFrame* pMainFrame = new CMainFrame;
if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME))
return FALSE;
m_pMainWnd = pMainFrame;
pMainFrame->ShowWindow(m_nCmdShow);
pMainFrame->UpdateWindow();
This creates and displays your main window. Avoid this and the window will not be created. However, you SHOULD return FALSE from the InitInstance function, although either it will enter the application message pump.
source
share