Question:
C++ keyboard inputs (like CTRL+ALT+DEL) but with real letters?
Nick D
2007-11-28 18:36:48 UTC
I want to write a program that does various commands when certain combonations of letters are pushed down simultaneously. (much like how CTRL+ALT+DEL works) I would like the user to be able to do that with the 'letter keys'. I am vaguely familliar with the buffer system of the keyboard. Is there a way around this? I thought about having the user push some other key (such as the spacebar) to lock in their answer, but if this were possible, I would like some sort real time display on the screen to indicate what buttons are being held down before the user locks in his answer.
Is this possible to code? Could someone provide some sort of pseudocode or strategy to accomplish this? Thanks.
Three answers:
tfloto
2007-11-28 18:53:52 UTC
If you're doing this in windows, there is a WM_KEYDOWN , (KeyPress event in DotNet) message that your application will get. It's an event so you get it when it happens at that point you can decide what to do with the key. getch() etc block until you hit enter so those are pretty useless. I am not sure what to tell if you're using linux or unix.
Dark-River
2007-11-28 18:49:14 UTC
Yes, this is possible to code.



You can either use the windows messages for key presses in the main message loop, or you can use DirectInput.



In either case you will need to create a map to associate the windows virtual key value, or the directX key value to a string representation.



When the associated key is pressed (0x80 for the action code) the user is currently holding that key. You can then lookup the value using the map and key value. When the key is relased the windows message loop or direct X will return the key with action code 0x00.





I have created a DirectInput API that does just this (amongst many other things). So, yes, you can do it.



Lookup 'keyboard message event handling' or 'DirectInput 9' for more information.
?
2016-11-13 04:53:10 UTC
extra suitable than probable your non everlasting cache is only too finished, that's an area of abode windows that remembers the place you have been on the internet and different a number of archives. try this; initiate > All Programmes > upload-ons > gadget methods > Disk Cleanup. once you're there i might additionally provide your gadget a competent "defragmentation". additionally use a competent anti-secret agent ware programmes (Adaware, Spybot seek and destroy) to ascertain for something that has lingered when you have wiped sparkling upir laptop. yet another suggestion is do no longer use cyber web Explorer (even the recent version) and use Firefox or Opera as your internet Browser. playstation . once you Defragment your annoying stress (in case you haven't any longer executed it for a at the same time as) run it a number of circumstances.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Continue reading on narkive:
Loading...