在基本单文档mfc程序中,我想让一个非模式对话框刚好覆盖整个view的client区域,在CMainFrame的create函数写到:
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
...... CRect rect;
CView* pview = this->GetActiveView();
if (pview != NULL)
{
pview->GetClientRect(&rect);
}
else
{
AfxMessageBox("error");
}
dlg.Create(IDD_DIALOG1,this);
dlg.SetWindowText("dlg");
dlg.ShowWindow(SW_SHOWMAXIMIZED);
dlg.SetWindowPos(NULL,0,0,rect.Width(),rect.Height (),SWP_NOMOVE|SWP_NOZORDER);
dlg.UpdateWindow(); return 0;
}其中dlg为非模式对话框对象。
结果pview为NULL;请问要实现我的功能该怎么办呢?
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
...... CRect rect;
CView* pview = this->GetActiveView();
if (pview != NULL)
{
pview->GetClientRect(&rect);
}
else
{
AfxMessageBox("error");
}
dlg.Create(IDD_DIALOG1,this);
dlg.SetWindowText("dlg");
dlg.ShowWindow(SW_SHOWMAXIMIZED);
dlg.SetWindowPos(NULL,0,0,rect.Width(),rect.Height (),SWP_NOMOVE|SWP_NOZORDER);
dlg.UpdateWindow(); return 0;
}其中dlg为非模式对话框对象。
结果pview为NULL;请问要实现我的功能该怎么办呢?
解决方案 »
- Linker Error:Undefined symbol '_main' in module cos
- 我使用VC做了个DLL,参数为BSTR s,在PB中调用,参数为A1C1,可在调用过程中DLL中显示为AC空格空格,着是为什么?
- ATL控件在中文名文件夹下注册不上?
- 如何获得AVI的总帧数?
- _ConnectionPtr pConn的Close问题
- 哪位高手有VC函数的中文帮助。谢谢
- 如何启动一个新线城?在线等待!谢谢!
- 我自己开发了一个数据库组件需要返回记录集,可是为什么在VC环境下无法调用
- VC6.0中 如何定义数据流,并写入word中?
- 一个关于WINSOCK的问题???
- classWizard中看不到自定义的类
- CToolTipCtrl如何动态更新内容?(支持多行显示)
在View的InitalUpdate函数里面添加那些代码试一下
cannot access protected member declared in class 'MyDlg'
MyDlg::~MyDlg' : cannot access protected member declared in class 'MyDlg'