Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[C++ Help] Holding down a key.

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
AwayTheWInd
Master Cheater
Reputation: 0

Joined: 11 Sep 2007
Posts: 450

PostPosted: Sun Mar 22, 2009 7:56 am    Post subject: [C++ Help] Holding down a key. Reply with quote

Ok, i cant get my program to hold down a key. im specifically using this method:

keybd_event(VK_SPACE,0,0,0);


and leaving it like that.

It seems to only press space once, and not hold it down o.O

whats wrong with it?

_________________
Back to top
View user's profile Send private message
talkerzero
Grandmaster Cheater
Reputation: 1

Joined: 24 Jul 2008
Posts: 560
Location: California

PostPosted: Sun Mar 22, 2009 8:20 am    Post subject: Reply with quote

keybd_event will press the key, not hold it down/let it go. You can accomplish what you're trying to do with SendInput.
Back to top
View user's profile Send private message Visit poster's website
AwayTheWInd
Master Cheater
Reputation: 0

Joined: 11 Sep 2007
Posts: 450

PostPosted: Sun Mar 22, 2009 8:22 am    Post subject: Reply with quote

keybd_event uses SendInput.

also, i tried SendInput and it did not work.

these are my functions:

void SpaceDown()
{
Input.type = INPUT_KEYBOARD;
Input.ki.wVk = VK_SPACE;
Input.ki.dwFlags = 0;
Input.ki.time = 0;
SendInput(1,&Input, sizeof(INPUT));
RtlZeroMemory(&Input, sizeof(INPUT));
}
void SpaceUp()
{
Input.type = INPUT_KEYBOARD;
Input.ki.wVk = VK_SPACE;
Input.ki.dwFlags = KEYEVENTF_KEYUP;
Input.ki.time = 0;
SendInput(1,&Input, sizeof(INPUT));
RtlZeroMemory(&Input, sizeof(INPUT));
}

_________________
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites