CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    May 1999
    Posts
    15

    How do I capture keystrokes at the Windows level? In MFC?

    I want to get system-level control of keystrokes and mouse position. I would prefer to use MFC because I am not proficient in C++ at the system level. Any source of sample code would be appreciated also.

    I apoligize in advance because I am SURE that the above question has been asked in the past. I just can't find the answer!

    Thanks.




    Larry Woods
    l.woods, inc.
    Scottsdale, Arizona

  2. #2
    Join Date
    May 1999
    Posts
    10

    Re: How do I capture keystrokes at the Windows level? In MFC?

    Have you tried mapping WM_KEYDOWN (occurs with any key presses) or WM_CHAR (only occurs on character keys)?


  3. #3
    Join Date
    May 1999
    Posts
    15

    Re: How do I capture keystrokes at the Windows level? In MFC?

    This will only give me control for keystrokes from my thread, I believe. I want to interrogate ALL keystrokes from ALL windows.

    Isn't this true?

    Larry Woods
    l.woods, inc.
    Scottsdale, Arizona

  4. #4
    Join Date
    May 1999
    Posts
    82

    Re: How do I capture keystrokes at the Windows level? In MFC?


  5. #5
    Join Date
    May 1999
    Posts
    4

    Re: How do I capture keystrokes at the Windows level? In MFC?

    I'm not sure if you are looking for these but I understood you needed the name of functions that deal with keystrokes and mouse positions. I apologize if this is not what you want.
    You have OnChar() OnKepUp() and OnKeyDown() member funtions of class CWnd. They activate on response to keystrokes. OnKeyDown() activates on response to keystrokes in keys like DEL even.
    Then you have OnSysChar() , OnSysKeyUp() and OnSysKeyDown() for system keys and combination of ALT+key.
    Remember that only the active window will receive messages on response to these events.
    To catch mouse position remember you have OnLButtonDown() OnLButtonUp() OnRButtonDown() OnLRuttonUp() OnMouseMove() and more.

    Xexi
    "Life's a journey, not a destination"

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