Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

MFC Doubt

Chaitanya_PuneChaitanya_Pune Member Posts: 87
Mouse capturing doubt
When we capture mouse using CWnd::SetCapture all mouse related messages are routed to the window that has captured mouse.
Now as we know that at a time only one window can capture mouse what if some other application also use CWnd::SetCapture.
Which window will capture mouse our application's window or other application's window?

Comments

  • AsmGuru62AsmGuru62 Member Posts: 6,519
    : Mouse capturing doubt
    : When we capture mouse using CWnd::SetCapture all mouse related messages are routed to the window that has captured mouse.
    : Now as we know that at a time only one window can capture mouse what if some other application also use CWnd::SetCapture.
    : Which window will capture mouse our application's window or other application's window?
    :
    [blue]Usually, this function is called when mouse is clicked on some object and user HOLDS the mouse button down. Only one application at a time can do that. So, if your application HWND get the capture - there is a little chance that other application can get it. However, it is still possible to lose capture because some other application can 'wake up' by a timer or some otrher mechanism and force mouse capture out of your application. For these cases there is a message WM_CAPTURECHANGED:

    http://msdn2.microsoft.com/en-us/library/ms645605.aspx

    There is nothing wrong with losing a capture, however, just stop the action you performing while dragging the mouse.
    [/blue]
Sign In or Register to comment.