hey guys,
I'm trying to write a tray app in c++ for my htpc to take input from my mce remote and translate it into text, like sms on your phone, 1 = abc etc...
I know pretty much how to do it except for one thing. I want to use hotkeys which can be toggled on or off depending when i want to use the sms input. So if i press 1 it will run the abc() function which will use a timer to count the keypresses within a couple of seconds and translate that into the correct letter/number. However what I can't figure out is what happens when I press 1 which calls abc() and then immediately press 2 which calls def() and then immediately after I press 1 again.
abc() will still be running when I press 2 and then when I press 1 again it will just increment the count of 1 so instead of getting an output of ada I would get bd.
I need some way of telling abc() that it needs to finish when another key is pressed and then when it is finished run def().
I hope this makes sense. If you have any idea, doesn't need to be code, I would appreciate it.
Thanks.
EDIT: As a side note, how can I get the program to do nothing indefinately until one of the hotkeys are pressed? Atm I'm using a loop which is using 100% cpu usage:O


LinkBack URL
About LinkBacks
Reply With Quote