?
Solved

How to use SendKeys() in MFC

Posted on 2004-04-05
6
Medium Priority
?
1,934 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
  • 3
  • 2
6 Comments
 
LVL 16

Accepted Solution

by:
nonubik earned 60 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
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.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month13 days, 17 hours left to enroll

807 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