|
-
April 3rd, 2005, 12:30 PM
#2
Re: How to find the running program and send some message to it?
-Use the System.Diagnostics.Process class to get a list of running processes by name, handle, or window handle. Or if you prefer, inspect all window titles to find your process.
-Look out to catch System.Diagnostics.Win32Exception
-Determine which instance of your program to send messages to by inspecting the process start time. (Check the 'Ticks' property of DateTime. That should be more accurate)
-Use Process.CloseMainWindow() or Process.Kill() to exit whichever instance you need to exit.
Last edited by kin2pete; April 3rd, 2005 at 12:47 PM.
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
|