473,378 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Sending Key-press to another process

I got a "Process A" that starts several other programs.
Sometimes i want to send KeyBoard commands to these programs when i start
them.

For Example:

1. Process A starts Outlook
Process now got a process-object that points to the Outlook program

2. Process A send the Keybord commands "Ctrl+Shift+M" to OutLook
How do i do Step 2?

Remember that Process A can start up any kind of program, so this isn't just
for Outlook. It can be any kind of program.
Nov 20 '05 #1
4 7074
CMG
Check out this MSDN Topic.
http://msdn.microsoft.com/library/default.asp?
url=/library/en-
us/cpref/html/frlrfsystemwindowsformssendkeysclasstopic.asp

This one has some examples about what you need, enjoy.
-----Original Message-----
I got a "Process A" that starts several other programs.
Sometimes i want to send KeyBoard commands to these programs when i startthem.

For Example:

1. Process A starts Outlook
Process now got a process-object that points to the Outlook program
2. Process A send the Keybord commands "Ctrl+Shift+M" to OutLook

How do i do Step 2?

Remember that Process A can start up any kind of program, so this isn't justfor Outlook. It can be any kind of program.
.

Nov 20 '05 #2
* "Jarod_24" <ja******@hotmail.com> scripsit:
I got a "Process A" that starts several other programs.
Sometimes i want to send KeyBoard commands to these programs when i start
them.

For Example:

1. Process A starts Outlook
Process now got a process-object that points to the Outlook program

2. Process A send the Keybord commands "Ctrl+Shift+M" to OutLook
How do i do Step 2?

Remember that Process A can start up any kind of program, so this isn't just
for Outlook. It can be any kind of program.


Have a look at 'AppActivate' and the methods of the 'SendKeys' class.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #3

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:uY**************@TK2MSFTNGP10.phx.gbl...
* "Jarod_24" <ja******@hotmail.com> scripsit:
I got a "Process A" that starts several other programs.
Sometimes i want to send KeyBoard commands to these programs when i start them.

For Example:

1. Process A starts Outlook
Process now got a process-object that points to the Outlook program
2. Process A send the Keybord commands "Ctrl+Shift+M" to OutLook
How do i do Step 2?

Remember that Process A can start up any kind of program, so this isn't just for Outlook. It can be any kind of program.


Have a look at 'AppActivate' and the methods of the 'SendKeys' class.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>


AppActivate simply dosen't work.

I tried it and except for one time, it returns "invalid ProcessID" (when it
isn't)

I found out that the SetForegroundWindow API function can be used, but i
haven't a clue to what to do.
Anyone got any links to places where i can get a short introduction to these
API's and a little knowledge about how to code this in a VB.Net project?
It's impossible to find anything about this on MSDN.

SetForegroundWindow :
http://msdn.microsoft.com/library/de...functions/setf
oregroundwindow.asp
Nov 20 '05 #4

"Jarod_24" <ja******@hotmail.com> wrote in message
news:82******************************@news.teranew s.com...

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:uY**************@TK2MSFTNGP10.phx.gbl...
* "Jarod_24" <ja******@hotmail.com> scripsit:
I got a "Process A" that starts several other programs.
Sometimes i want to send KeyBoard commands to these programs when i start them.

For Example:

1. Process A starts Outlook
Process now got a process-object that points to the Outlook program
2. Process A send the Keybord commands "Ctrl+Shift+M" to OutLook
How do i do Step 2?

Remember that Process A can start up any kind of program, so this
isn't
just for Outlook. It can be any kind of program.
Have a look at 'AppActivate' and the methods of the 'SendKeys' class.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>


AppActivate simply dosen't work.

I tried it and except for one time, it returns "invalid ProcessID" (when

it isn't)

I found out that the SetForegroundWindow API function can be used, but i
haven't a clue to what to do.
Anyone got any links to places where i can get a short introduction to these API's and a little knowledge about how to code this in a VB.Net project?
It's impossible to find anything about this on MSDN.

SetForegroundWindow :
http://msdn.microsoft.com/library/de...functions/setf oregroundwindow.asp


help!!!!
Nov 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Kelly | last post by:
Can anyone see why this wouldn't work? I get the mail but it is always blank. The key is installed on the server properly (so I am told). Basically the encrypting of the message seems to be the...
2
by: Nis Sarup | last post by:
A customer of mine wants to make a newsletter for their website. The newsletter should be HTML with images and sent to a database of her subscribers. They would like a script where they can easily...
13
by: joe215 | last post by:
I want my users to send emails from a Windows app that I am developing in Visual Basic.NET 2003. I found a good example of sending email to a SMTP server using the SmtpMail class. However, using...
2
by: Wilfried Mestdagh | last post by:
Hi, How do I send a mouse click and keyboard key's to my main form in code ? -- rgds, Wilfried http://www.mestdagh.biz
2
by: KvS | last post by:
Hi all, I have a wxPython GUI consisting of a wxWindow -> wxPanel -> set of widgets. I need to catch pressed keys no matter which widget has focus, so I've attached an event handler to the panel...
0
by: net2knot | last post by:
want to send numpad enter to a dos application. i used sendkeys but none of the use. i tried a module but it sends the standard enter key rather than numpad enter key, since standard enter key and...
1
by: net2knot | last post by:
want to send numpad enter to a dos application. i used sendkeys but none of the use. i tried a module but it sends the standard enter key rather than numpad enter key, since standard enter key and...
7
by: bleachie | last post by:
Hey, I just need some help, my form seems to not send me all of the 'guestNames' and 'guestEmails' forms. i use this function to add more guestnames and guestemail fields based on the number of...
1
by: net2knot | last post by:
want to send numpad enter to a dos application. i used sendkeys but none of the use. i tried a module but it sends the standard enter key rather than numpad enter key, since standard enter key and...
4
by: George Oliver | last post by:
hi, I'm a novice programmer trying to better define a hobby project I'm thinking of. What I would like to do is take a program and embed it or put it within a Python-run GUI, using the GUI just...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.