| View previous topic :: View next topic |
| Author |
Message |
Splizes Grandmaster Cheater Supreme
Reputation: 0
Joined: 21 Jun 2006 Posts: 1944 Location: Florida
|
Posted: Fri Oct 05, 2007 2:27 pm Post subject: [VC++ 6] How do you creat a hotkey in a gui app? |
|
|
| ive looked on google and they all wind up being for cmd prompts
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
|
| Back to top |
|
 |
Splizes Grandmaster Cheater Supreme
Reputation: 0
Joined: 21 Jun 2006 Posts: 1944 Location: Florida
|
Posted: Fri Oct 05, 2007 2:34 pm Post subject: |
|
|
| I need an example of this used.
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Fri Oct 05, 2007 2:48 pm Post subject: |
|
|
| Code: | | RegisterHotKey(hwnd, 0x0001, 0, VK_F5); |
we register our hotkey, it's ID is 1 and the key is F5.
http://msdn2.microsoft.com/en-us/library/ms912649.aspx
looking at this we see: WM_HOTKEY idHotKey = (int) wParam so...
| Code: | case WM_HOTKEY:
switch(wParam)
{
case 0x0001:
//do wonderful things
break;
}
return TRUE; |
| Code: |
UnregisterHotKey(hwnd, 1); |
When we're done, free up the resources.
|
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Fri Oct 05, 2007 2:50 pm Post subject: |
|
|
use
if(!RegisterHotkey(crap in here)){
show your error message
}
it will attempt to register it, if it can't you get a message
_________________
|
|
| Back to top |
|
 |
|