|
-
August 29th, 2009, 11:43 AM
#1
Control another program's flow ...?
Hello,
I'd like to know how if it's possible to write a program to 'control' another program.
For instance, let's say i'd like to open Word, change the font, and insert some text. Is there any way to 'get a hook' on another running program's resource, and trigger events like keystrokes or a mouse click ?
Thank you!!
-
August 29th, 2009, 12:45 PM
#2
Re: Control another program's flow ...?
Welcome to the forum 
yes it is very much possible. I would take an example of Word itself. MS Word exposes an COM Object Library that you can use to automate MS Word application. You can all that you have mentioned and much more.
If you want to automate some other program that not expose an object library, you will have to rely on SendMessage API. Do a search here and you will numerous examples of how to use SendMessage to control another application.
-
August 29th, 2009, 12:58 PM
#3
Re: Control another program's flow ...?
Thanks a lot for your reply..!!. I'll take a look on SendMessage.
-
August 29th, 2009, 01:38 PM
#4
Re: Control another program's flow ...?
Sorry to bother here again...
SendKeys would work great for what i need to do. However i'm having trouble opening a 3rd party program which is minimized to tray.
I've been testing the MS API... ShowWindow and SetForegroundWindow are both not working.
I'm using it this way...
Process[] processes = Process.GetProcessesByName("test");
foreach (Process p in processes) {
ShowWindow(p.Handle, 5);
}
Also tested with p.MainWindowHandle... any idea?
Thanks a lot in advance =D
-
August 31st, 2009, 05:21 AM
#5
Re: Control another program's flow ...?
There might be some other APIS to do a search which are there in the tray minimized. Just do a search you may get a API related to that ...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|