CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: HotKey

  1. #1
    Join Date
    May 1999
    Location
    TamilNadu, India
    Posts
    42

    HotKey

    Hi,
    I want to put a HotKey to my application means, it should open my application window which will be minimized... Means that If I am working with some other application and If I press that Hotkey I should be able to trap that hotkey and open my application... how can I do this..
    Thanks lot,
    Srini


  2. #2
    Guest

    Re: HotKey

    see registerhotkey in msdn


  3. #3
    Join Date
    May 1999
    Location
    TamilNadu, India
    Posts
    42

    Re: HotKey

    I wrote the code like this... I don't get where the problem is. Still unable to solve the problem.Thanks lot for ur answer and solution. The code is

    int a = (int)GlobalAddAtom("Tasksrini");
    d = GetLastError();
    if (RegisterHotKey((HWND)this,a,MOD_ALT|MOD_CONTROL ,30) == 0)
    {
    d = GetLastError();
    AfxMessageBox("hello wrong");



    Can u please let me know where I am doing some mistake?
    Thanks lot,
    Srini


  4. #4
    Join Date
    May 1999
    Posts
    31

    Re: HotKey

    Hi,

    If the problem is that the actual RegisterHotKey call returns zero, it probably means that the hotkey you chose is already in use. If the problem is that nothing happens when you press the hotkey, that is because your window must handle the WM_HOTKEY message.

    Daniel.


  5. #5
    Join Date
    May 1999
    Location
    Republic of Korea
    Posts
    100

    Re: HotKey

    I did use hotkey as following:

    SendMessage(WM_SETHOTKEY,(WPARAM)MAKEWORD(VK_F12,HOTKEYF_CONTROL|HOTKEYF_SHIFT));

    U get hotkey message thru WM_SYSCOMMAND
    so overide that message and check for
    SC_HOTKEY and then do appropriate stuff.

    It worked for my app.
    Let me know whether it works for U.

    Hope for help.

    Walter



  6. #6
    Join Date
    May 1999
    Location
    TamilNadu, India
    Posts
    42

    Re: HotKey

    Hi,
    Thanks a lot and lot. Finally problem got solved. It is working fine now.... The problem is, the first parameter I gave this, insteaf I gave m_hWnd... It works fine...
    Thanks lot,
    srini


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured