CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(CCWinAppDoc), RUNTIME_CLASS(CMainFrame), RUNTIME_CLASS(CCWinAppView)); pDocTemplate->SetContainerInfo(IDR_CNTR_INPLACE); AddDocTemplate(pDocTemplate);// Parse command line for standard shell commands, DDE, file open CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // Dispatch commands specified on the command line if (!ProcessShellCommand(cmdInfo)) return FALSE; 我在断点调试中是在if (!ProcessShellCommand(cmdInfo))处进入 CMainFrame::CMainFrame()的,这里是何意思?
这个在编程的时候用不到吧
class CWinThread : public CCmdTarget
{
DECLARE_DYNAMIC(CWinThread)public:
// Constructors
CWinThread();
BOOL CreateThread(DWORD dwCreateFlags = 0, UINT nStackSize = 0,
LPSECURITY_ATTRIBUTES lpSecurityAttrs = NULL);// Attributes
CWnd* m_pMainWnd; // main window (usually same AfxGetApp()->m_pMainWnd)
CWnd* m_pActiveWnd; // active main window (may not be m_pMainWnd)
BOOL m_bAutoDelete; // ena
在里面执行初始化!
那么CMainFrame::CMainFrame()什么时候执行
这一步隐含在 CYouApp::InitInstance 时候执行。
里面有个构造单/多文档摸版实例。
最终 MFC 框架通过 CMainFrame 的 RuntimeClass 来创建 CMainFrame 对象。
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CCWinAppDoc),
RUNTIME_CLASS(CMainFrame),
RUNTIME_CLASS(CCWinAppView));
pDocTemplate->SetContainerInfo(IDR_CNTR_INPLACE);
AddDocTemplate(pDocTemplate);// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo); // Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
我在断点调试中是在if (!ProcessShellCommand(cmdInfo))处进入
CMainFrame::CMainFrame()的,这里是何意思?