473,586 Members | 2,546 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 7082
CMG
Check out this MSDN Topic.
http://msdn.microsoft.com/library/default.asp?
url=/library/en-
us/cpref/html/frlrfsystemwind owsformssendkey sclasstopic.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******@hotma il.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******** ******@TK2MSFTN GP10.phx.gbl...
* "Jarod_24" <ja******@hotma il.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 SetForegroundWi ndow 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.

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

"Jarod_24" <ja******@hotma il.com> wrote in message
news:82******** *************** *******@news.te ranews.com...

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:uY******** ******@TK2MSFTN GP10.phx.gbl...
* "Jarod_24" <ja******@hotma il.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 SetForegroundWi ndow 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.

SetForegroundWi ndow :
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
2066
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 only thing that doesn't work. I have stepped through it many times and the message is fine until it gets encrypted then it becomes blank. I should at...
2
1929
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 compose and send the newsletter. I can write that, but wouldnt like to reinvent the weel. Does anybody here have any good recomendations on...
13
3206
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 this, it seems, that the user must install IIS on their computer. Isn't there a class that will detect whatever mail server is available on a...
2
2088
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
2528
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 but I can't seem to find a way to do some kind of collective "sending through" of the key event from all the widgets on the panel to that handler...
0
988
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 numpad enter key share same ascii value. but the dos application reacts to numpad enter key. please help me...i need an urgent solution of this...
1
1558
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 numpad enter key share same ascii value. but the dos application reacts to numpad enter key. please help me...i need an urgent solution of this...
7
3324
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 guests added. form.php function createGuestNameAndEmailElements() {
1
1828
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 numpad enter key share same ascii value. but the dos application reacts to numpad enter key. please help me...i need an urgent solution of this...
4
1668
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 to capture and send input to the application, and display the ouput. Specifically I want to use a Python module such as wxPython, pygame or...
0
8204
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8339
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6617
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5712
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5392
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3838
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.