MoveWindow()运行出错!!
大家好,我想使单文档CFromview中 的控件随窗口变化,我新编了一个CSynname类,保存了CFromview中控件的地址,在onsize中调控件大小
OnSize(UINT nType, int cx, int cy)
{
// CFormView::OnSize(nType, cx, cy);
//m_m_pControlArray是CPtrArray存放控件的信息
// TODO: Add your message handler code here
if (kong==TRUE)
{
int nIncrementX = cx - m_nWinWidth;
int nIncrementY = cy - m_nWinHeight;
int i=0;
int nMoveXPercent = ((CSynname*)m_pControlArray.GetAt(i))->m_nMoveXPercent;
int nMoveYPercent = ((CSynname*)m_pControlArray.GetAt(i))->m_nMoveYPercent;
int nZoomXPercent = ((CSynname*)m_pControlArray.GetAt(i))->m_nZoomXPercent;
int nZoomYPercent = ((CSynname*)m_pControlArray.GetAt(i))->m_nZoomYPercent;
CWnd*pWndCtrl=((CSynname*)m_pControlArray.GetAt(0))->m_pWnd;
HWND hWnd = pWndCtrl->GetSafeHwnd();
//if((NULL!=pWndCtrl)&&IsWindow(hWnd))
// {
int nLeft = ((CSynname*)m_pControlArray.GetAt(0))->m_rectWnd.left;
int nTop = ((CSynname*)m_pControlArray.GetAt(0))->m_rectWnd.top;
int nWidth = ((CSynname*)m_pControlArray.GetAt(0))->m_rectWnd.Width();
int nHeight = ((CSynname*)m_pControlArray.GetAt(0))->m_rectWnd.Height();
//设置新的位置参数
nLeft += (nIncrementX*nMoveXPercent/100);
nTop += (nIncrementY*nMoveYPercent/100);
nWidth += (nIncrementX*nZoomXPercent/100);
nHeight += (nIncrementY*nZoomYPercent/100);
// 把控件移动到新位置
pWndCtrl->MoveWindow(nLeft, nTop, nWidth, nHeight);
// }
//}*/
}
}单步运行到pWndCtrl->MoveWindow(nLeft, nTop, nWidth, nHeight);程序就崩溃,大家看看什么原因,谢谢!!
OnSize(UINT nType, int cx, int cy)
{
// CFormView::OnSize(nType, cx, cy);
//m_m_pControlArray是CPtrArray存放控件的信息
// TODO: Add your message handler code here
if (kong==TRUE)
{
int nIncrementX = cx - m_nWinWidth;
int nIncrementY = cy - m_nWinHeight;
int i=0;
int nMoveXPercent = ((CSynname*)m_pControlArray.GetAt(i))->m_nMoveXPercent;
int nMoveYPercent = ((CSynname*)m_pControlArray.GetAt(i))->m_nMoveYPercent;
int nZoomXPercent = ((CSynname*)m_pControlArray.GetAt(i))->m_nZoomXPercent;
int nZoomYPercent = ((CSynname*)m_pControlArray.GetAt(i))->m_nZoomYPercent;
CWnd*pWndCtrl=((CSynname*)m_pControlArray.GetAt(0))->m_pWnd;
HWND hWnd = pWndCtrl->GetSafeHwnd();
//if((NULL!=pWndCtrl)&&IsWindow(hWnd))
// {
int nLeft = ((CSynname*)m_pControlArray.GetAt(0))->m_rectWnd.left;
int nTop = ((CSynname*)m_pControlArray.GetAt(0))->m_rectWnd.top;
int nWidth = ((CSynname*)m_pControlArray.GetAt(0))->m_rectWnd.Width();
int nHeight = ((CSynname*)m_pControlArray.GetAt(0))->m_rectWnd.Height();
//设置新的位置参数
nLeft += (nIncrementX*nMoveXPercent/100);
nTop += (nIncrementY*nMoveYPercent/100);
nWidth += (nIncrementX*nZoomXPercent/100);
nHeight += (nIncrementY*nZoomYPercent/100);
// 把控件移动到新位置
pWndCtrl->MoveWindow(nLeft, nTop, nWidth, nHeight);
// }
//}*/
}
}单步运行到pWndCtrl->MoveWindow(nLeft, nTop, nWidth, nHeight);程序就崩溃,大家看看什么原因,谢谢!!
...全文
相关推荐
MoveWindow() SetWindowPos()的区别于联系
"MoveWindow() 和 SetWindowPos() 函数在VC++编程中的区别与联系"在Windows编程中,经常需要对窗口的位置和大小进行调整,这时就会用到`MoveWindow()`
MoveWindow,是完全源码的PB开发示例,实现MoveWindow全新效果!
MoveWindow函数的基本语法如下:```cppBOOL MoveWindow( HWND hWnd, int X, int Y, int nWidth, int nHeight, BOOL bRepaint
:: MoveWindow保留空白区域
通过结合文档内容和以上分析,你应该能更好地理解和解决“MoveWindow保留空白区域”的问题。
MoveWindow 屏幕启动动画
《MoveWindow:屏幕启动动画详解》在计算机编程领域,特别是在Windows系统开发中,`MoveWindow`函数扮演着至关重要的角色。
MoveWindow_C#源码_
标题中的"MoveWindow_C#源码_"表明这是一个关于C#编程语言的项目,具体来说,是使用C#实现窗口移动动画的功能。


界面
