 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
systat Advanced Cheater
Reputation: 0
Joined: 15 Feb 2008 Posts: 54
|
Posted: Fri Feb 29, 2008 3:22 pm Post subject: Sending KEYS, ASAP!!! |
|
|
OMG, I really dont know where am I making mistake, if I do exactly this
I got this problem in Shaiya and in Fiesta...
It doesnt work with keybd_event nor SendInput
Code: | Sleep(300);
keybd_event(VK_RETURN,0,0,0);
Sleep(300);
keybd_event(VK_RETURN,0,KEYEVENTF_KEYUP,0);
Sleep(300);
|
This works correctly, it open chat, and close chat
But whenever i want to do something, to move my character or to simulate bottun click
Code: | Sleep(300);
keybd_event('W',0,0,0);
Sleep(300);
keybd_event('W',0,KEYEVENTF_KEYUP,0);
Sleep(300);
|
This Doesnt work, character doesnt move, but when i press enter i got w(lowercase) spam in chat, how to simulate other keys, this doesnt work...
If i try to use VK_1, or VK_W, i got undeclared indentifier error, I am using VS 2008
Any suggestions, plz...
_________________
uuuuuuuuuuuuu |
|
Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Fri Feb 29, 2008 3:56 pm Post subject: |
|
|
if you want to use keys like 0-9 and A-Z then you have to define them yourself because Microsoft didnt do it.
Either that or you can just plug the value of the key right into keybdevent.
All the Virtual Keys and Key Values: http://www.quickmacros.com/help/index.php?topic=Tables/IDP_VIRTUALKEYS.html
put this at the top of your coding.
#define VK_1 0x31 // Key 1
#define VK_W 0x57 // Key W
if you want to define any other keys then do the same but different name and value from the Virtual key link i gave above.
_________________
|
|
Back to top |
|
 |
systat Advanced Cheater
Reputation: 0
Joined: 15 Feb 2008 Posts: 54
|
Posted: Fri Feb 29, 2008 4:11 pm Post subject: |
|
|
I still got same problem, like it doesnt hold 'W' key down enough to start moving, can any help?
_________________
uuuuuuuuuuuuu |
|
Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Fri Feb 29, 2008 4:33 pm Post subject: |
|
|
Send in constantly.
Create a seperate thread, or timer, and have a for/while loop
for(;;Sleep(10))
{
keybd_event( VK_W,0,0,0);
Sleep(10);
keybd_event( VK_W,0,KEYEVENTF_KEYUP,0);
if ( bBoolToExit == true ) ExitThread(0); // if your using a seperate thread
if ( bBoolToExit == true ) KillTimer( parameters here ); // for timer
}
try also not doing a KEYUP until u want it to exit. so that its holding the key down.
_________________
|
|
Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Fri Feb 29, 2008 4:41 pm Post subject: |
|
|
As said by the MSDN for keybd_event:
Windows NT/2000/XP/Vista:This function has been superseded. Use SendInput instead.
SendInput
http://msdn2.microsoft.com/en-us/library/ms646310(VS.85).aspx
If you are trying to send keys to a specific window, I would suggest looking into PostMessage. This way you will only be sending it to the single window and not to anything that has focus at the time. There are plenty of topics on the forums in this section about using PostMessage so you should be able to find what you need.
_________________
- Retired. |
|
Back to top |
|
 |
systat Advanced Cheater
Reputation: 0
Joined: 15 Feb 2008 Posts: 54
|
Posted: Fri Feb 29, 2008 4:44 pm Post subject: |
|
|
Yea, I was using constant loop even before, and it works for Americas Army, but for Shaiya, Fiesta & Metin2 doesnt, and I dont have idea why
_________________
uuuuuuuuuuuuu |
|
Back to top |
|
 |
iRiot Master Cheater
Reputation: 0
Joined: 03 Jul 2007 Posts: 395 Location: Aka RIOT
|
Posted: Fri Feb 29, 2008 5:09 pm Post subject: |
|
|
u can try postmessage
h:HWND;
h:=FindWindow(nil,'WINDOW HERE');
PostMessage(h,WM_KEYDOWN,$0,0);
_________________
Last edited by iRiot on Fri Feb 29, 2008 5:17 pm; edited 3 times in total |
|
Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Fri Feb 29, 2008 5:15 pm Post subject: |
|
|
iRiot wrote: | u can try postmessage
h:HWND;
h:=FindWindow(nil,'');
PostMessage(h,WM_KEYDOWN,$0,0); |
If you need it in C++:
HWND hWnd = FindWindow( "ClassHere OR", "Window Name Here" );
PostMessage( hWnd, WM_KEYDOWN, VK_W, 0 );
_________________
|
|
Back to top |
|
 |
systat Advanced Cheater
Reputation: 0
Joined: 15 Feb 2008 Posts: 54
|
Posted: Fri Feb 29, 2008 7:02 pm Post subject: |
|
|
Now I am really concerned, I dont know why it doesnt move character, but it does press W, I am sure about that, because whenever I press Enter, chat opens, and there it spams wwwwwwwwwwwwwwwwwwwwwwwwww.
_________________
uuuuuuuuuuuuu |
|
Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Fri Feb 29, 2008 7:11 pm Post subject: |
|
|
Try this
Code: | DWORD vkW = MapVirtualKey( VK_W, NULL );
_asm shl [vkW], 16
PostMessage( hWnd, WM_KEYDOWN, VK_W, vkW ); |
_________________
|
|
Back to top |
|
 |
iRiot Master Cheater
Reputation: 0
Joined: 03 Jul 2007 Posts: 395 Location: Aka RIOT
|
Posted: Fri Feb 29, 2008 7:53 pm Post subject: |
|
|
yeah shl 16 should bypass it and if u need that in delphi since lurc posted it in c++ and u havn't yet said what ur programming in so here
Code: | var
h : HWND;
A : DWORD;
begin
h:=FindWindow(nil,'WINDOW');
A:=MapVirtualKey($0,0);
A:=A shl 16;
if h<>0 then
begin
PostMessage(h,WM_KEYDOWN,$0,A);
sleep(10);
PostMessage(h,WM_KEYUP,$0,A);
Application.ProcessMessages;
end;
end; |
_________________
Last edited by iRiot on Fri Feb 29, 2008 8:13 pm; edited 3 times in total |
|
Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Fri Feb 29, 2008 7:59 pm Post subject: |
|
|
Lol, i know about "<<" i just didnt know how to properly use it
my guess without reading that link:
vkW = vkW << 16;
shl works just as well, so it doesnt really matter.
ill read that explination on the link though.
_________________
|
|
Back to top |
|
 |
Snootae Grandmaster Cheater
Reputation: 0
Joined: 16 Dec 2006 Posts: 969 Location: --->
|
Posted: Sat Mar 01, 2008 12:39 am Post subject: |
|
|
Quote: | Now I am really concerned, I dont know why it doesnt move character, but it does press W, I am sure about that, because whenever I press Enter, chat opens, and there it spams wwwwwwwwwwwwwwwwwwwwwwwwww. |
from that it sounds like maple's api blocks, you cant send stuff to chat box, but it wont work for everything else
try using postmessage as those guys said^
_________________
|
|
Back to top |
|
 |
systat Advanced Cheater
Reputation: 0
Joined: 15 Feb 2008 Posts: 54
|
Posted: Sat Mar 01, 2008 3:40 am Post subject: |
|
|
Code: | HWND hWnd = FindWindow(0,L"Shaiya");
if(hWnd)
cout << "OK" << endl;
for(;;) {
if(GetAsyncKeyState(VK_F7)&1) {
for(;;) {
if(GetAsyncKeyState(VK_F8)&1)
system("pause");
Sleep(10);
DWORD vkW = MapVirtualKey( VK_W, NULL );
_asm shl [vkW], 16
PostMessage( hWnd, WM_KEYDOWN, VK_W, vkW ) ;
}
}
}
}
|
Here is the that chunk of code, still only spams chat, anyhow i noticed that when i press enter, it spams code with W, and when i press enter again to send text, it seems like text isn't there, i was sending that in normal chat, and above my head should appear text i entered, but nothing happened after i pressed enter!!!!
_________________
uuuuuuuuuuuuu |
|
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
|
|