Solved

How to use SendKeys() in MFC

Posted on 2004-04-05
6
1,823 Views
Last Modified: 2013-11-20
We use a function SendKeys() in visual vabic of shell object. We send keys to other applications(like notepad,word etc.) by sendkeys.
I'm unable to access SendKeys in MFC. how can i access it or how can i send messages to other applications in MFC?
and how can i access shell object in MFC?
Waiting for reply.
and thanks for your response for my first question(deletesystemfile).
0
Comment
Question by:ManojKrChauhan
[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
  • 3
  • 2
6 Comments
 
LVL 16

Accepted Solution

by:
nonubik earned 20 total points
ID: 10757922
To send messages to other applications, you can use CWnd::SendMessage(..) http://msdn.microsoft.com/library/en-us/vclib/html/_mfc_CWnd.3a3a.SendMessage.asp
0
 

Author Comment

by:ManojKrChauhan
ID: 10766392
Can i send keyboard event to other application using SendMesage().
I want to send TAB key event to other application. how can i do it?
0
 
LVL 16

Expert Comment

by:nonubik
ID: 10766474
SendMessage(hAppWnd, WM_KEYDOWN, VK_TAB, 0), where the hAppWnd is the application's window handle
0
Industry Leaders: 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!

 

Author Comment

by:ManojKrChauhan
ID: 10766809
It's not working. I open an exe through WinExec then send message to it.
no problem in WM_CLOSE,WMSETTEXT,WM_GETTEXT.
But keyboard messagees are not working. I want to send TAB key to application(without pressing it)
waiting for reply.
0
 
LVL 4

Expert Comment

by:mblat
ID: 10788756
Do you have control of other application?  Basically you are the one who is writing it or you trying to control 3rd party app?
0
 

Author Comment

by:ManojKrChauhan
ID: 10866282
I have done for sendmessage. Thanks
There is a problem related with sendkeys
when i open file file by shell function then it bacame active by appactivate() and i can send keys to its window by Sendkeys(). But when i open any file by shell.run the i activate the window by appactivate and tried to send keys. then keys don't send to its windows. I want to send keys to window which is open by shell.run
Like .MSC file we can open mmc.exe (only by shell.run() not shell() or winexec() or shellexecute())for win2k. when i open .msc file then i try to activate its window by appactivate() setforegroundwindow() etc. but no success.
 so please give a reply how can i send keys to such applications
             thanks
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Expand data scrubbing tool 13 36
Process filename extension 3 209
while loop over for loop 7 116
sumHeights2  challenge 7 131
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…
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…
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.

733 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