|
-
August 7th, 2011, 08:24 AM
#1
C++ problem with sending keystrokes
I'm trying to send keystrokes to another application(so far succesfully) but it wont send the '%', hex value should be 0x25, I have tried multiple times, I'm pretty sure my code is fine so:/. Any way I can send a % anyway?
-
August 7th, 2011, 09:03 AM
#2
Re: C++ problem with sending keystrokes
 Originally Posted by Doomy
I'm trying to send keystrokes to another application(so far succesfully) but it wont send the '%', hex value should be 0x25, I have tried multiple times, I'm pretty sure my code is fine so:
Then what is the problem if your code is fine? Or it is NOT fine since it fails by sending '%' char? 
 Originally Posted by Doomy
Any way I can send a % anyway?
Perhaps using SendInput API. 
And, BTW, how are you doing it now?
Victor Nijegorodov
-
August 7th, 2011, 10:37 AM
#3
Re: C++ problem with sending keystrokes
 Originally Posted by VictorN
Then what is the problem if your code is fine? Or it is NOT fine since it fails by sending '%' char?
Perhaps using SendInput API. 
And, BTW, how are you doing it now?
The only thing that fails is sending the % char, all other letters numbers and signs(I need atleast) work, I've seen a lot of people use SendInput() but I have yet to find a good explanation of how to use it, can you help me?
I forgot to add I'm using keybd_event now (I know I should be using SendInput but as I stated before I haven't seen anyone use it in a simple way for anyone to understand -.~)
I'm kinda a newby with API
Last edited by Doomy; August 7th, 2011 at 10:48 AM.
-
August 7th, 2011, 10:51 AM
#4
Re: C++ problem with sending keystrokes
 Originally Posted by Doomy
I've seen a lot of people use SendInput() but I have yet to find a good explanation of how to use it, can you help me?
Just search the Forums for SendInput examples...
Victor Nijegorodov
-
August 7th, 2011, 10:58 AM
#5
Re: C++ problem with sending keystrokes
 Originally Posted by VictorN
Just search the Forums for SendInput examples...
but that doesnt explain why i cant send a % with keybd_event..
-
August 7th, 2011, 11:28 AM
#6
Re: C++ problem with sending keystrokes
Define "cant send a % with keybd_event"
What fails: keybd_event? Or "another application" doesn't react to the '%' sign been sent?
Victor Nijegorodov
-
August 7th, 2011, 04:16 PM
#7
Re: C++ problem with sending keystrokes
 Originally Posted by VictorN
Define "cant send a % with keybd_event"
What fails: keybd_event? Or "another application" doesn't react to the '%' sign been sent?
A keyboardevent is being sent but its not a %, it seems to be simulating left arrow key or something...
-
August 7th, 2011, 04:25 PM
#8
Re: C++ problem with sending keystrokes
And how is it interpreted if you *directly* (via keyboard) "send" % to this application?
Victor Nijegorodov
-
August 7th, 2011, 04:31 PM
#9
Re: C++ problem with sending keystrokes
 Originally Posted by Doomy
A keyboardevent is being sent but its not a %,
How do you know it?
keybd_event does not return any value (it is void) so it is impossible to know whether it succeeds or fails (note that Sendinput type is int and if it filed then GetLastError will give you the extended error info)
Victor Nijegorodov
-
August 7th, 2011, 08:08 PM
#10
Re: C++ problem with sending keystrokes
 Originally Posted by VictorN
How do you know it?
keybd_event does not return any value (it is void) so it is impossible to know whether it succeeds or fails (note that Sendinput type is int and if it filed then GetLastError will give you the extended error info)
I had it use an autokey in a textbox with text that was marked, after the keybdevents it wasnt marked anymore and the blinking | was one character from the end instead of the end
-
August 7th, 2011, 09:39 PM
#11
Re: C++ problem with sending keystrokes
 Originally Posted by Doomy
I had it use an autokey in a textbox with text that was marked, after the keybdevents it wasnt marked anymore and the blinking | was one character from the end instead of the end
Let us see the code that calls keybd_event for this character, including the values you're using to call keybd_event.
Regards,
Paul McKenzie
-
August 8th, 2011, 01:05 AM
#12
Re: C++ problem with sending keystrokes
 Originally Posted by Doomy
I had it use an autokey in a textbox with text that was marked, after the keybdevents it wasnt marked anymore and the blinking | was one character from the end instead of the end
Could it be that % sign has some special meaning for this text box?
Victor Nijegorodov
-
August 8th, 2011, 08:39 PM
#13
Re: C++ problem with sending keystrokes
 Originally Posted by VictorN
Could it be that % sign has some special meaning for this text box?
no i tried putting a % in myself it worked fine
-
August 9th, 2011, 05:12 AM
#14
Re: C++ problem with sending keystrokes
 Originally Posted by Doomy
no i tried putting a % in myself it worked fine
So are we to keep guessing, or are you going to show us your code?
Regards,
Paul McKenzie
-
August 9th, 2011, 06:19 AM
#15
Re: C++ problem with sending keystrokes
 Originally Posted by Paul McKenzie
So are we to keep guessing, or are you going to show us your code?
Regards,
Paul McKenzie
keybd_event(0x25, 0, 0, 0);
keybd_event(0x25, 0, KEYEVENTF_KEYUP, 0);
there, does that help in any way? i doubt it.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|