我建立了单文档工程文件,想在单文档的主窗口弹出时,下半部分显示对话框,别人的能实现我的不行,求解,工程文件.cpp中的部分代码如下:
SetRegistryKey(_T("Local AppWizard-Generated Applications")); LoadStdProfileSettings(); // Load standard INI file options (including MRU)// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
SetDialogBkColor(RGB(210,230,210), RGB ( 0 ,0 , 0 ) );
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CWinPingDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(SCANPLAN)); //SCANPLAN为我想显示的对话框对应的类
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;
// The one and only window has been initialized, so show and update it.
SCANPLAN *pDlg;
pDlg=new SCANPLAN;
pDlg->Create(IDD_SCANPLAN_DIALOG,NULL);
pDlg->UpdateWindow();
pDlg->ShowWindow(SW_SHOW);
m_pMainWnd=pDlg;
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
以上代码运行后对话框不在主窗口内部,都能显示,但不符合要求。谢谢高手解答。散分100!
SetRegistryKey(_T("Local AppWizard-Generated Applications")); LoadStdProfileSettings(); // Load standard INI file options (including MRU)// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
SetDialogBkColor(RGB(210,230,210), RGB ( 0 ,0 , 0 ) );
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CWinPingDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(SCANPLAN)); //SCANPLAN为我想显示的对话框对应的类
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;
// The one and only window has been initialized, so show and update it.
SCANPLAN *pDlg;
pDlg=new SCANPLAN;
pDlg->Create(IDD_SCANPLAN_DIALOG,NULL);
pDlg->UpdateWindow();
pDlg->ShowWindow(SW_SHOW);
m_pMainWnd=pDlg;
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
以上代码运行后对话框不在主窗口内部,都能显示,但不符合要求。谢谢高手解答。散分100!
解决方案 »
- variant * 参数问题
- Windows Media Format SDK 10, 关于修改WMV文件头种的Attributes 的问题
- 对话框A创建非模式对话框B,拖动对话框A到另一个位置,使B跟随A移动到一个相应的位置
- wwwsq(wwwsq),请进!
- 一个超级菜的问题
- 用visual studio 2008写了个启动eclipse的程序,eclipse无法弹出选择工作空间的对话框
- 模板类的成员函数在Class Wizard中找不到?
- 学vc要花多久呀?半年?一年?
- 菜单栏项的属性为PopUp时,如何设置点些这项的快捷键
- gluLookAt (0.0, 0.0, 2.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0);//这个表示头向左歪了45度?为啥没效果呢?
- 高分求解Debug Assertion Failed dll加载出问题;
- 程序能正常运行,Debug下的exe出错
这样报错,把this改为NULL就没错误。
你也不看看当前this指针完全建立好了么!当前窗口创建好了么?既然当前窗口么有创建好,那么请问你怎么把窗口显示在主窗口中?
所以说你的代码要改!
怎么改?自己去想想,比如说:OnCreate() OnInitialUpDate()等等函数之后再去执行窗口自己的窗口
你好!以上的代码是在CMainFrame的InitInstance()函数里写的,刚才我又在Oncreate函数里试了一下,还是不行,你能给我讲讲吗?谢谢了。
现在怎么不说话了?刚才还大言不惭的说“瞬间”就改了?
估计是改不出来吧?郁闷