哥们 没效果图 就是做成能移动窗口就可以if (pMsg->message == WM_NCLBUTTONDOWN)
{
return TRUE;
}
if (pMsg->message == WM_NCLBUTTONUP)
{
return TRUE;
}
if (pMsg->message == WM_NCMOUSEMOVE)
{
return TRUE;
} 在这三个消息里面移动 窗口 不用默认处理就这个功能!
{
return TRUE;
}
if (pMsg->message == WM_NCLBUTTONUP)
{
return TRUE;
}
if (pMsg->message == WM_NCMOUSEMOVE)
{
return TRUE;
} 在这三个消息里面移动 窗口 不用默认处理就这个功能!
解决方案 »
- 清除上次绘制的痕迹MFC
- 要带界面解非线性方程的程序
- 内存使用异常?
- 高手帮帮忙:关于对话框的销毁问题
- 请教大家一个visual studio中有关输出的问题
- winsock 简单的下载文件问题(我写了一些,不好用请大家帮我改改)多谢了。。
- 哪里有电子版:Visual C++网络通信协议分析与应用实现(书到再加80分)
- 除了microsoft.com,哪有新的Microsoft Platform SDK download ?
- 怎样判断网页内容完全打开
- VC中一个关于内存的问题!!
- 关于createprocess与UAC框或者杀软的问题,望解答
- MFC中Doc,View,MainFrmae,App各指针的互相获取(不完整版本)
void CxxxxxxDlg::OnNcMouseMove(UINT nHitTest, CPoint point)
{
// if(nHitTest==HTCAPTION) CDialog::OnNcMouseMove(nHitTest, point);
static CPoint lastPt;
while(GetAsyncKeyState(VK_LBUTTON) & 0x8000)
{
CRect rc;
GetWindowRect(rc);
rc.OffsetRect(-rc.left,-rc.top);
MoveWindow(point.x-lastPt.x,point.y-lastPt.y,rc.Width(),rc.Height());
}
lastPt=point;
}
{
static CPoint lastPt;
CRect rc;
GetWindowRect(rc);
while(GetAsyncKeyState(VK_LBUTTON) & 0x8000)
{// afxDump << lastPt << "\n";
MoveWindow(rc.left+point.x-lastPt.x,rc.top+point.y-lastPt.y,rc.Width(),rc.Height());
GetCursorPos(&point);
}
lastPt=point;
// CDialog::OnNcMouseMove(nHitTest, point);
}
这段代码放 :
OnNcHitTest(CPoint point)
将使 全窗口 都可以移动.
{
return DefWindowProc(hwnd, msg, wparam, lparam);
}
case WM_NCMOUSEMOVE://截取消息
{
POINT point;
point.x = LOWORDINT(lparam);
point.y =HIWORDINT(lparam);
RECT rc;
GetWindowRect(hwnd,&rc);
while(GetAsyncKeyState(VK_LBUTTON) & 0x8000)
{// afxDump << lastPt << "\n";
MoveWindow(hwnd,rc.left+point.x-pHGE->lastPt.x,rc.top+point.y-pHGE->lastPt.y,rc.right,rc.bottom,TRUE);
GetCursorPos(&point);
}
pHGE->lastPt=point; return TRUE;
} 我想要的效果是 结合 WM_NCLBUTTONDOWN 和移动消息来做这个功能可以嘛 分数我在给你加100谢谢了
void CMyImageDlg::OnNcLButtonDown(UINT nHitTest, CPoint point)
{
// CDialog::OnNcLButtonDown(nHitTest, point);
}必须注释掉,
否则:
void CMyImageDlg::OnNcMouseMove(UINT nHitTest, CPoint point)
{
static CPoint lastPt;
CRect rc;
GetWindowRect(rc);
while(GetAsyncKeyState(VK_LBUTTON) & 0x8000)
{// only no OnNcLButtonDown()
afxDump << lastPt << "\n";
MoveWindow(rc.left+point.x-lastPt.x,rc.top+point.y-lastPt.y,rc.Width(),rc.Height());
GetCursorPos(&point);
}
lastPt=point;
// CDialog::OnNcMouseMove(nHitTest, point);
}你的移动不是这段代码的结果 (afxDump << lastPt << "\n"; 无输出, OutputDebugStri())
void CMyImageDlg::OnNcLButtonDown(UINT nHitTest, CPoint point)
{
static CPoint lastPt;
lastPt=point;
if(nHitTest==HTCAPTION)
{
CRect rc;
GetWindowRect(rc);
while(GetAsyncKeyState(VK_LBUTTON) & 0x8000)
{//
afxDump << lastPt << "\n";
MoveWindow(rc.left+point.x-lastPt.x,rc.top+point.y-lastPt.y,rc.Width(),rc.Height());
GetCursorPos(&point);
}
}
else
{
CDialog::OnNcLButtonDown(nHitTest, point);
}
}
case WM_NCLBUTTONDOWN:
/////////////////////////////////////////////////////////////////
WM_NCLBUTTONDOWN
nHittest = (INT) wParam; // hit-test value
pts = MAKEPOINTS(lParam); // position of cursor