Solved

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

Posted on 1998-09-10
1
227 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need a Shell script to start a service checking the port 6 55
Define unique primary key 9 95
Excel file not created as expected 7 94
Problem to App 4 120
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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.
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

726 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