哥们  没效果图 就是做成能移动窗口就可以if (pMsg->message == WM_NCLBUTTONDOWN)
{
return TRUE;
}
if (pMsg->message == WM_NCLBUTTONUP)
{
return TRUE;
}
if (pMsg->message == WM_NCMOUSEMOVE)
{
return TRUE;
} 在这三个消息里面移动 窗口 不用默认处理就这个功能!

解决方案 »

  1.   

    一个就够了
    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;
    }
      

  2.   

    5楼代码有点问题,改正:void CMyImageDlg::OnNcMouseMove(UINT nHitTest, CPoint 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)
    将使 全窗口 都可以移动.
      

  3.   

    楼上的代码可以移动但是有个问题 如果我单机标题栏移动  但是他就是黑色的了没渲染,  你给我的代码 只是移动做了处理   case WM_NCLBUTTONDOWN:  你还是给了系统处理        case WM_NCLBUTTONDOWN:
    {
    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谢谢了
      

  4.   

    MFC 上:
    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())
      

  5.   

    看看在::OnNcLButtonDown 下 行不行?//
    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);
    }
    }
      

  6.   

    兄弟还是不行可以加下我QQ吗  直接MFC 可以我这个是捕鱼程序就有那个问题QQ495167321
      

  7.   

    看看你的:
    case WM_NCLBUTTONDOWN:
    /////////////////////////////////////////////////////////////////
    WM_NCLBUTTONDOWN 
    nHittest = (INT) wParam;    // hit-test value 
    pts = MAKEPOINTS(lParam);   // position of cursor