[C++] Really basic question - mousemove relatively

Post a reply


In an effort to prevent automatic submissions, we require that you complete the following challenge.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :| :mrgreen: :geek: :ugeek: :arrow: :angel: :clap: :crazy: :eh: :lolno: :problem: :shh: :shifty: :sick: :silent: :think: :thumbup: :thumbdown: :salute: :wave: :wtf: :yawn: :facepalm: :bravo: :dance: :beard: :morebeard: :xmas: :HeHe: :trollface: :cookie: :rainbow: :monkeysee: :monkeysay: :happybday: :headwall: :offtopic: :superhappy: :terms: :beer:
View more smilies

BBCode is ON
[img] is OFF
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: [C++] Really basic question - mousemove relatively

Re: [C++] Really basic question - mousemove relatively

Post by guest3456 » 16 Nov 2016, 09:01

ahhh, maybe that second client is checking for ahk scripts running as part of its bot protection

Re: [C++] Really basic question - mousemove relatively

Post by Brazolek123 » 16 Nov 2016, 05:11

Well, Im playing one game with two different game clients. On one client all functions works properly controlclick and control-mouse click drag no matter if is on top or is maximized or minimized on c++ and ahk ver. Whereas while playing on second client, the one with a good bot protection only c++ ver works propely. But in this case I must to place this relative mouse movement so game client will be able to recognize object movement.

Re: [C++] Really basic question - mousemove relatively

Post by guest3456 » 15 Nov 2016, 18:33

Brazolek123 wrote: 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.
It obviously doesn't work perfectly heh :)

How do you even know this will work at all? I've never heard of being able to click minimized windows

And AHK has PostMessage so if it even is possible, there's no need for C++. You can do ControlClick U/D and then PostMessage the WM_MOUSEMOVE. Looks like Lexikos even posted an attempt here:
https://autohotkey.com/board/topic/4063 ... -dragging/

[C++] Really basic question - mousemove relatively

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!

Top