Server Help

Trash Talk - how to create a hotkey in c++

Anonymous - Sat Apr 19, 2008 12:37 am
Post subject: how to create a hotkey in c++
i searched rohitab cplus plus google all kinds of shit and could not find anything on how to create a hotkey for you program in c++ like how to make something that when you press CTRL+A a message box pops up and says hello?
Samapico - Sat Apr 19, 2008 1:19 am
Post subject:
You need a form first

Once you get the form, you should be able to have a 'keypress' event from it.

I'm really not sure how this works in c++... never used forms with it
hellzlaker - Sat Apr 19, 2008 9:03 am
Post subject:
thanks allot, i really didn't were to even start searching and on google lots of BS came up
Anonymous - Sat Apr 19, 2008 9:19 am
Post subject:
What do you mean by hotkey? Like using a Windows + Letter combo. Theres a windows API call to set that up.
http://www.codeproject.com/KB/system/nishhotkeys01.aspx
nice example there
Samapico - Sat Apr 19, 2008 10:47 am
Post subject:
I think he meant a shortcut to a menu item...
hmm... now that I think of it, if you can find a menu control, the menu items might have a shortcut property (like you can set up Ctrl+S for a 'save' item)
D1st0rt - Sun Apr 20, 2008 4:55 pm
Post subject:
You could listen to keyboard events and then do something when specific ones happen
Cheese - Sat Apr 26, 2008 1:01 am
Post subject:
i know how to code a hotkey in win32 c++, but only while the window is active...

IF ANYONE CAN FIND OUT HOW TO CODE A GLOBAL HOTKEY, THAT WOULD BE AWESOME.
Doc Flabby - Sun Apr 27, 2008 8:27 am
Post subject:
Cheese wrote:
i know how to code a hotkey in win32 c++, but only while the window is active...

IF ANYONE CAN FIND OUT HOW TO CODE A GLOBAL HOTKEY, THAT WOULD BE AWESOME.


http://www.codeproject.com/KB/system/nishhotkeys01.aspx
I already have, used the info in this link icon_smile.gif
Cheese - Mon Jun 30, 2008 5:05 pm
Post subject:
was reviewing stuff...
never implemented this fully,
i dont like codeproject, where else is there info?

because if i did
Code: Show/Hide

RegisterHotKey(hwnd, 101, MOD_ALT, 'H');
case WM_HOTKEY:
      {
         MessageBox(hwnd,"wm hotkey","wm hotkey",MB_OK | MB_ICONINFORMATION);
         if(lParam == 101)
         {
            MessageBox(hwnd,"wm hotkey","101",MB_OK | MB_ICONINFORMATION);
}
      }
      break;

alt h anywhere would bring up wmhotkey box, but not 101.


-edit-
messed around, found that wparam controls it, so nvm
proper code:
Code: Show/Hide

RegisterHotKey(hwnd, 101, MOD_ALT, 'H');
RegisterHotKey(hwnd, 102, MOD_ALT, 'J');
...
case WM_HOTKEY:
      {
         if(wParam == 101)
         {
            MessageBox(hwnd,"101 W","wm hotkey",MB_OK | MB_ICONINFORMATION);
         }
         if(wParam == 102)
         {
            MessageBox(hwnd,"102 W","wm hotkey",MB_OK | MB_ICONINFORMATION);
         }
      }
      break;


cheese's win32 to do list:


any help on any of these would be appreciated
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group