Solved

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

Posted on 1998-09-10
1
197 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Change owner from userA to server Local Administrators 7 62
sumNumber challenge 16 122
either24  challenge 19 97
java ^ examples 8 65
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

785 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