I want to drag this character. Image :
so i use this method to get mouse position:
WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
...
switch (message){
case WM_LBUTTONDOWN:
case WM_MOUSEMOVE:
GetCursorPos(&mousePosition);
break;
}
...
}
The program seems to be running well, but if the mouse is out of the characters location, it wouldn't follow the mouse cursor anymore.
How can I fix this problem?
See
SetCapture
on MSDN:SetCapture
..ReleaseCapture
lets you temporarily extend your mouse event handling to space outside the window [where the event originated from].You have some sample/demo here: