|
-
April 4th, 2001, 01:30 PM
#1
Detecting the Alt state
In my application, I would like to change the icon when the user presses Alt (Alt only, no other character, so i cannot use the KeyDown Event). How do I do it?
I plan to use a global boolean variable AltPressed and a timer that ticks every 100 ms, and use GetKeyState in each timer tick to detect the Alt State.
Is there a neater solution?
-
April 4th, 2001, 03:16 PM
#2
Re: Detecting the Alt state
Another choice would be to make a keyboard hook, so that all key events are seen by the hook. That way you can ignore all non-Alt key events and then toggle your global variable on the Alt events. I have recently been looking into keyboard hooks for another project and I have a couple of good sites to check out depending on what you want to do.
If you want a local hook [only recieves keystrokes from within your application], take a look here:
http://vbaccelerator.com/codelib/hook/vbalhook.htm
If you need a system wide hook, I found a neat control that will do it:
http://www.scottandmichelle.net/scot...mv?codenum=082
Hope this helps.
Nathan
-
April 4th, 2001, 10:56 PM
#3
Re: Detecting the Alt state
Thanks,
And I got hooked onto something else there - the Cool Menu. I was looking for a method to make my menus better.
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
|