PDA

View Full Version : Make mouse go on dialog



HydroQc
05-03-2008, 10:40 PM
I want to make my mouse go on the dialog when it appears...o it will help the person. It will not be necessary he need to look for the mouse.

Fragment
05-06-2008, 02:26 PM
Ok dawg.
so basically, what I think you want is, when someone alt tabs to your hack, you want the mouse to move so that it's on TOP OF the trainer correct?

Sounds sorta complicated. I'll do my best to help ya.

ALRIGHT. so.
Well, I would think to put on a timer the function seeing what the foreground window is.



bool moved; //GLOBALLY DECLARE THIS BOOL (do not put it in any function.)
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
//Your timer code... I would set the milliseconds to 1
DWORD PId1;
DWORD PId2;
HWND Hackwindow;
HWND Currwind;
Hackwindow = FindWindow(0, "/*Put your trainer's window name here*/");
Currwind = GetForegroundWindow();
GetWindowThreadProcessId(Hackwindow, &PId1);
GetWindowThreadProcessId(Currwind, &PId2);
if (PId1 == PId2)
{
if (moved == false)
{
moved = true;
int x;
int y;
x = Form1->Left;
y = Form1->Top;
x = x + ((Form1->Width)/2);
y = y + ((Form1->Height)/2);
SetCursorPos(x,y);
}

}
else
{
moved = false;
}

}

And i don't know about you but that works perfectly for me. Someone should sticky this as it is a good idea.

And it is coded so that the mouse goes in the CENTER of the hack, not off to the edge or a corner. Good idea man! This should be standardized.

HydroQc
05-06-2008, 03:18 PM
But where tdo i put this code in a timer?? Do i have to activate the timer then?? OPr iw will auto-activate?

Fragment
05-07-2008, 02:02 PM
But where tdo i put this code in a timer?? Do i have to activate the timer then?? OPr iw will auto-activate?

Um... There is a tutorial on here I think on how to add a timer in visual C++, and it should enable when you start the program.. I haven't tried to see what it would be like to have this code in game. The thing that is in the brackets after the Timer1 is the whole code you put in the timer.