-
Mar 24th, 2014, 11:03 AM
#1
Thread Starter
Junior Member
How do you send and capture keystrokes?
Hi, Im trying to figure out how to use the USB thermometer here:
http://pcsensor.com/index.php?_a=product&product_id=41
It installs itself as a keyboard to the system and if you press the Capslock key for 2 seconds, it will "type" data like this:
CAPS LOCK:ON/OFF/++ FW:1.4
NUM LOCK:OFF/ON/-- UNIT:C
23.25 1S
23.25 1S
23.25 1S
23.25 1S
23.25 1S
23.25 1S
23.25 1S
23.25 1s
Until you hold down Capslock key again for 2 seconds.
So Im trying to determine how I would get my program to "Hold down" the caps lock key then record the data that is being "typed" by this device. And, once its typed, it only pulls the numeric temperature data to output to a label or text box. Im stuck on the sendkeys part for holding down the key.
Thanks
-
Mar 24th, 2014, 02:43 PM
#2
Addicted Member
Re: How do you send and capture keystrokes?
It doesn't look like programmatically you can Hold a key down. Look at this post
_____________
Tim
If anyone's answer has helped you, please show your appreciation by rating that answer.
When you get a solution to your issue remember to mark the thread Resolved.
reference links
-
Mar 24th, 2014, 03:17 PM
#3
Member
Re: How do you send and capture keystrokes?
http://www.devepic.com/grabme.php?fi...l%20Basic.docx
The Above is to explain one way of using sendkeys and numpad, however it should have enough information for you to adapt it to your needs.
Perhaps one way of doing it would be to setup a timer or a loop that "spams" the capslock key very quickly?
-
Mar 24th, 2014, 08:01 PM
#4
Re: How do you send and capture keystrokes?
You can send Windows messages that correspond to a key being depressed and a key being released. If you were to send those two messages over two seconds apart then that may well correspond to holding down the specified key for two seconds. The thing is though, you have to send a message to a specific window. Maybe if you were to specify the desktop window it would work.
You should look into using FindWindow to get the handle of the desktop and then using SendMessage to send it the WM_KEYDOWN and WM_KEYUP messages with a greater than two-second delay in between. I'm not 100% sure that it would work but it's my first instinct.
-
Mar 26th, 2014, 03:30 PM
#5
Addicted Member
Re: How do you send and capture keystrokes?
I had a quick look at the link and on the packaging of the device written in bad English it says
"Supply API function for dll win OS".
That suggests there is a dll you could use to interface with the device. Something to investigate.
Last edited by 2ndmessiah; Mar 26th, 2014 at 03:35 PM.
Think.... Question.....
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
|