Message by windows on keypress

This is a discussion on Message by windows on keypress within the Windows Programming forums, part of the Platform Specific Boards category; I want windows to send message to my programme when a specific key combination is pressed even when my window ...

  1. #1
    Registered User cfrost's Avatar
    Join Date
    Apr 2004
    Posts
    119

    Lightbulb Message by windows on keypress

    I want windows to send message to my programme when a specific key combination is pressed even when my window is minimized or not shown (i.e) minimized to systray or it is pressed while some other application was active

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    RegisterHotKey(). Beware that your hot key may already be in use. You can let the user choose a hot key with a hot key control(HOTKEY_CLASS).

  3. #3
    Registered User cfrost's Avatar
    Join Date
    Apr 2004
    Posts
    119
    give me some example of hot key usage

  4. #4
    Registered User
    Join Date
    Jul 2003
    Posts
    59
    http://msdn.microsoft.com/library/de...sterHotKey.asp

    BOOL RegisterHotKey(HWND hWnd,
    int id,
    UINT fsModifiers,
    UINT vk
    );

    Example:

    RegisterHotKey(m_hWnd, ID_EXIT,
    MOD_ALT | MOD_SHIFT, VK_F1);

    This will generate a WM_HOTKEY meessage when alt+shift+f1 is pressed. wParam will contain the ID.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Strange string behavior
    By jcafaro10 in forum C Programming
    Replies: 2
    Last Post: 04-07-2009, 08:38 PM
  2. Global Variables
    By Taka in forum C Programming
    Replies: 34
    Last Post: 11-02-2007, 04:25 AM
  3. Custom Windows Message.
    By Mastadex in forum Windows Programming
    Replies: 9
    Last Post: 05-10-2006, 02:43 PM
  4. Menu Item Caption - /a for right aligned Accelerator?
    By JasonD in forum Windows Programming
    Replies: 6
    Last Post: 06-25-2003, 12:14 PM
  5. How come this only works in Windows nt/2000?
    By Unregistered in forum Windows Programming
    Replies: 1
    Last Post: 08-30-2002, 07:54 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21