Sending a keystroke to the active window as if typed at the keyboard.

Posted on 1998-09-10
Medium Priority
Last Modified: 2013-11-20
I want to send a keystroke to another app. (16.bit, old)
i've tried:
      CWnd* pDoptT;
      pDoptT      =  GetNextWindow(GW_HWNDNEXT);
        CString strWindowTitle;
        if(strWindowTitle.Find("App to receive key") !=-1)
            //found the app i want to send keystrokes
            ::SendMessage(pDoptT->m_hWnd,WM_KEYDOWN, (WPARAM) iVirtKeyCode, (LPARAM) 0);
            pDoptT      = DoptT->GetNextWindow(GW_HWNDNEXT);
      }while(pDoptT != NULL);

somehow the other app does not react, any other solutions?

                       thanx martin

Question by:mruff
1 Comment

Accepted Solution

psdavis earned 100 total points
ID: 1322059
Have you tried passing the character directly to the window?

pDotpT->OnChar( nChar, nRepCnt, nFlags );


pDotpT->OnKeyDown( nChar, nRepCnt, nFlags );


Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Free Data Recovery software is an advanced solution from Kernel Tools to recover data and files such as documents, emails, database, media and pictures, etc. It supports recovery from physical & logical drive after a hard disk crash, accidental/inte…
Suggested Courses

619 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