Solved

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

Posted on 1998-09-10
1
169 Views
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);
      do
      {
        CString strWindowTitle;
          pDoptT->GetWindowText(strWindowTitle);
        if(strWindowTitle.Find("App to receive key") !=-1)
          {
            //found the app i want to send keystrokes
          ::SetForegroundWindow(pDoptT->m_hWnd);
            ::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



0
Comment
Question by:mruff
1 Comment
 
LVL 7

Accepted Solution

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

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

or

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

Phillip
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

708 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

13 Experts available now in Live!

Get 1:1 Help Now