 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
GRB Advanced Cheater
Reputation: 0
Joined: 17 Nov 2006 Posts: 53
|
Posted: Sun Mar 09, 2008 1:50 pm Post subject: Some Help! |
|
|
Can anyone help me here plz?
| Code: | #include <windows.h>
#include <winuser.h>
#include <windef.h>
BOOL qQuit = FALSE;
HMODULE mModule;
void Thread()
{
while ( !bWantQuit )
{
if (GetAsyncKeyState(VK_F1))
{
MessageBox (NULL, L"Working", NULL, MB_OK);
}
if (GetAsyncKeyState(VK_F2))
{
keybd_event(VK_RETURN, 0, 0, 0);
keybd_event(VK_RETURN, 0, KEYEVENTF_KEYUP, 0);
::Sleep(500);
keybd_event(VK_NUMPAD1, 0, 0, 0);
keybd_event(VK_NUMPAD1, 0, KEYEVENTF_KEYUP, 0);
keybd_event(VK_NUMPAD2, 0, 0, 0);
keybd_event(VK_NUMPAD2, 0, KEYEVENTF_KEYUP, 0);
keybd_event(VK_RETURN, 0, 0, 0);
keybd_event(VK_RETURN, 0, KEYEVENTF_KEYUP, 0);
qQuit = TRUE;
}
}
FreeLibraryAndExitThread(mModule,0);
}
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
if (ul_reason_for_call == DLL_PROCESS_ATTACH)
{
DisableThreadLibraryCalls( hModule );
thisModule = hModule;
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)&Thread, (LPVOID)hModule, 0, 0);
}
return TRUE;
} |
This is to inject in a game!
I already have injected it and it works, but only works one time, how can i make it works everytime i press the F1?
EDIT: BTW this is just for testing purposes!
|
|
| Back to top |
|
 |
samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
Posted: Sun Mar 09, 2008 1:56 pm Post subject: Re: Some Help! |
|
|
| GRB wrote: | Can anyone help me here plz?
| Code: | #include <windows.h>
#include <winuser.h>
#include <windef.h>
BOOL qQuit = FALSE;
HMODULE mModule;
void Thread()
{
while ( !bWantQuit )
{
if (GetAsyncKeyState(VK_F1))
{
MessageBox (NULL, L"Working", NULL, MB_OK);
}
if (GetAsyncKeyState(VK_F2))
{
keybd_event(VK_RETURN, 0, 0, 0);
keybd_event(VK_RETURN, 0, KEYEVENTF_KEYUP, 0);
::Sleep(500);
keybd_event(VK_NUMPAD1, 0, 0, 0);
keybd_event(VK_NUMPAD1, 0, KEYEVENTF_KEYUP, 0);
keybd_event(VK_NUMPAD2, 0, 0, 0);
keybd_event(VK_NUMPAD2, 0, KEYEVENTF_KEYUP, 0);
keybd_event(VK_RETURN, 0, 0, 0);
keybd_event(VK_RETURN, 0, KEYEVENTF_KEYUP, 0);
qQuit = TRUE;
}
}
FreeLibraryAndExitThread(mModule,0);
}
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
if (ul_reason_for_call == DLL_PROCESS_ATTACH)
{
DisableThreadLibraryCalls( hModule );
thisModule = hModule;
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)&Thread, (LPVOID)hModule, 0, 0);
}
return TRUE;
} |
This is to inject in a game!
I already have injected it and it works, but only works one time, how can i make it works everytime i press the F1?
EDIT: BTW this is just for testing purposes! |
First off, change the DllEntry method:
| Code: |
switch( ul_reason_for_call )
{
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls( hModule );
thisModule = hModule;
CreateThread( 0, 0, ( LPTHREAD_START_ROUTINE ) &Thread, ( LPVOID ) hModule, 0, 0 );
return TRUE;
case DLL_PROCESS_DETACH:
bWantQuit = true;
return TRUE;
}
|
Then, in your method
| Code: |
//.....
keybd_event(VK_RETURN, 0, 0, 0);
keybd_event(VK_RETURN, 0, KEYEVENTF_KEYUP, 0);
}
|
(Basically, remove the bWantsQuit in the method, because that tells it to quit--the first part is simply good programming practice.)
_________________
|
|
| Back to top |
|
 |
GRB Advanced Cheater
Reputation: 0
Joined: 17 Nov 2006 Posts: 53
|
Posted: Mon Mar 10, 2008 5:52 am Post subject: |
|
|
| im just trying ti learn c++, tkz for ur help!
|
|
| Back to top |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Mon Mar 10, 2008 6:10 am Post subject: |
|
|
You declared qQuit but your loop is looping while bWantQuit is false, which isn't declared, and after you send "12" you change qQuit to true, just remove it if you don't want it to quit.
And you should use SendInput.
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|