Code: Select all
void dragDrop(HWND hWindow, POINT from, POINT to)
{
POINT currentPos = getCurrentPos(hWindow);
DWORD coordinates = MAKELPARAM(from.x, from.y);
PostMessage(hWindow, WM_MOUSEMOVE, 0, coordinates);
PostMessage(hWindow, WM_LBUTTONDOWN, MK_LBUTTON, coordinates);
INT relX = from.x - 10; // here starts the problem
INT relY = from.y + 10;
coordinates = MAKELPARAM(relX.x relY.y);
PostMessage(hWindow, WM_MOUSEMOVE, 0, coordinates);
Sleep(1); // end here it ends
coordinates = MAKELPARAM(to.x, to.y);
PostMessage(hWindow, WM_MOUSEMOVE, MK_LBUTTON, coordinates);
PostMessage(hWindow, WM_LBUTTONUP, 0, coordinates);
coordinates = MAKELPARAM(currentPos.x, currentPos.y);
PostMessage(hWindow, WM_MOUSEMOVE, 0, coordinates);
}
I need this because autohotkey's control click and mouse click drag doesnt work on my minimized window whereas this script written in c++ works perfectly. Thought I will be able to transform it somehow to dll file and then call it in my ahk script.
Thanks for help!