Search code examples
c#.netfocus

how to open program through C# program and give this program focus


How to open program through C# program (Windows Mobile) and give this program focus ?

EDIT by MarkJ: Gold says thanks for Process.Start suggestions, but for some reason the program still doesn't get the focus.

Thanks in advance, Gold


Solution

  • You can launch a program by calling Process.Start, like this:

    Process.Start(programPath);
    

    You can also pass in a file (eg, a Word document), or even a web site, and it will automatically launch in the default program for that file type on the user's machine.

    When you call Process.Start, the program should automatically receive focus.