?
Solved

How to use SendKeys() in MFC

Posted on 2004-04-05
6
Medium Priority
?
1,872 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 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
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!

 

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Suggested Courses

777 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