Post by Brazolek123 » 15 Nov 2016, 18:21
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);
}
Heey, its a really simple problem to solve, however I'm not so good in all this cpp variable types, so thought that maybe you will help me to modify it. All the marked part has to do is to movemouse relatively to 'from' position -10 to the right and + 10 pixels to up. Even looked through autohotkey source code but it is done a little bit different there, without all this makelparam things.
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!
[code]
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);
}
[/code]
Heey, its a really simple problem to solve, however I'm not so good in all this cpp variable types, so thought that maybe you will help me to modify it. All the marked part has to do is to movemouse relatively to 'from' position -10 to the right and + 10 pixels to up. Even looked through autohotkey source code but it is done a little bit different there, without all this makelparam things.
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!