Keep track of key press event of active window

Posted on 2004-10-28
Last Modified: 2013-11-20
I have two separate application. One application is active and another is running in background. Now I want to keep track of key press event of active application through application running in background. How can I do this in MFC.
Question by:syswareinc
    LVL 55

    Accepted Solution

    There is no specific MFC functions for windows hooking. Just have to use SetWindowsHookEx WinAPI's function.
    LVL 43

    Assisted Solution

    You could just pass a duplictae of the keypress to the background app from your main app (use RegisterWindowsMessage to generate a unique message)
    LVL 6

    Assisted Solution

    by:Amritpal Singh
    LVL 6

    Expert Comment

    by:Amritpal Singh
    we all suggested relative answers , points shud be split.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
    Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
    This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

    933 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now