CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Threaded View

  1. #2
    Join Date
    Mar 2005
    Posts
    8

    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
  •  





Click Here to Expand Forum to Full Width

Featured