WM_SYSCOMMAND SC_MOVE eats mouse events, but the mouse does not start

My program is a chrome window, and I want to move the window when the user drags any part of my dialog. When WM_SYSCOMMAND is used, all subsequent mouse events are lost.

First I wrote a program to capture mouse events and all work with WTL.

BEGIN_MSG_MAP(CMainDlg)
    MSG_WM_LBUTTONUP(OnMouseUp)
    MSG_WM_LBUTTONDOWN(OnMouseDown)
....
LRESULT OnMouseDown ( UINT uKeys, CPoint pt ) {
    print ("on mouse down");
    return 0;
}
LRESULT OnMouseUp ( UINT uKeys, CPoint pt ) {
    print ("on mouse up");
    return 0;
}

Then I change onMouseDown above to,

LRESULT OnMouseDown ( UINT uKeys, CPoint pt ) {
    print ("on mouse down");
    this->SendMessageW(WM_SYSCOMMAND, SC_MOVE|0x0002);
    return 0;
}

Drag and drop works, and windows move with the mouse. However, the OnMouseUp event no longer fires.

Tried many different approaches using WM_NCHITTEST or ProcessMessage setHandled to true / false without success.

It is very important if anyone has any suggestions :)

0
source share
2 answers
+6

DefWindowProc WM_SYSCOMMAND , . , SendMessage , , .

0

All Articles