void CChildFrame::OnSysCommand(UINT nID, LPARAM lParam)
{
CWnd *ChildWnd;
CRect WndRect;
// TODO: Add your message handler code here and/or call default
if(nID==SC_MAXIMIZE)
{
ChildWnd=AfxGetMainWnd()->GetActiveWindow();
ChildWnd->GetClientRect(&WndRect);
//ChildWnd->SetWindowPos(ChildWnd,WndRect.top,WndRect.right,WndRect.left,WndRect.bottom,SWP_NOMOVE);
ChildWnd->SetWindowPos(NULL, 0, 0, 200, 200,
SWP_NOMOVE|SWP_DRAWFRAME); }
//CMDIChildWnd::OnSysCommand(nID, lParam);
}
{
CWnd *ChildWnd;
CRect WndRect;
// TODO: Add your message handler code here and/or call default
if(nID==SC_MAXIMIZE)
{
ChildWnd=AfxGetMainWnd()->GetActiveWindow();
ChildWnd->GetClientRect(&WndRect);
//ChildWnd->SetWindowPos(ChildWnd,WndRect.top,WndRect.right,WndRect.left,WndRect.bottom,SWP_NOMOVE);
ChildWnd->SetWindowPos(NULL, 0, 0, 200, 200,
SWP_NOMOVE|SWP_DRAWFRAME); }
//CMDIChildWnd::OnSysCommand(nID, lParam);
}
解决方案 »
- VS2010中怎么添加ActiveMovie Control Object 在线等
- 哪位有view3ds的软件,就是把3ds文件 导成.gl和.h的那种,给我传一份?不胜感激
- 怎样把其他的窗口置为最顶层呢?
- 询问VC的调试技术!
- 小写的bool和大写的BOOL有什么区别呢?
- BQQ在局域网中自动寻找聊天服务器是怎么做的?
- 用CAsyncSocket或者CSocket如何检测对方突然掉电或者断网?
- 怎么知道系统没有任何鼠标键盘操作即idle了一段时间了?
- VC, text 文本请教!
- 网络的问题,请教
- 一个MFC获得指针的小问题,再现等待,立刻结分!
- 1000个client,如何更好的进行相互通信?
第一个参数是NULL?
第一个参数是NULL?
NULL 替换成 ChildWnd、AfxGetMainWnd()都不行呀!!!第一个参数到底有什么用呀!!
{
// TODO: Add your specialized code here and/or call the base class nCmdShow = SW_SHOWMAXIMIZED;
CMDIChildWnd::ActivateFrame(nCmdShow);
}
{
// TODO: Add your specialized code here and/or call the base classnCmdShow = SW_SHOWMAXIMIZED;
CMDIChildWnd::ActivateFrame(nCmdShow);
}我并不是要求,初始子窗口时最大化。而是想要达到 当我点击 子窗口最大化按钮时,子窗口的大小变成 200*200,我已经
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
cs.cx=100;
cs.cy=100;
if( !CMDIChildWnd::PreCreateWindow(cs) )
return FALSE; return TRUE;
}
pWndInsertAfter
Identifies the CWnd object that will precede this CWnd object in the Z-order. This parameter can be a pointer to a CWnd or a Pointer to one of the following values:
wndBottom Places the window at the bottom of the Z-order. If this CWnd is a topmost window, the window loses its topmost status; the system places the window at the bottom of all other windows.
wndTop Places the window at the top of the Z-order.
wndTopMost Places the window above all nontopmost windows. The window maintains its topmost position even when it is deactivated.
wndNoTopMost Repositions the window to the top of all nontopmost windows (that is, behind all topmost windows). This flag has no effect if the window is already a nontopmost window.
ChildWnd->SetWindowPos( &(childWnd->wndTop), 0, 0, 200, 200,
SWP_NOMOVE|SWP_DRAWFRAME);ChildWnd->SetWindowPos(NULL, 这样试试
WINDOWPLACEMENT *lpwndpl
);
SWP_NOMOVE|SWP_DRAWFRAME);其实不用去求 ChildWnd,用this就可以了。谢谢各位了。