Activate another running program in C#


This is actually quite simple. First add a reference to the Microsoft.VisualBasic library. Then call Microsoft.VisualBasic.Interaction.AppActivate, passing it the title of the program that you want to activate as in the following code.

using Microsoft.VisualBasic;
// Activate the program.
private void btnActivate_Click(object sender, EventArgs e)
    catch (Exception ex)

Note that the other program must be running or the program throws an ArgumentException and the program displays the message, “Process ‘whatever’ was not found.”

To start a program that isn’t running, see the example Open a file with the system’s default application in C#.

Download Example   Follow me on Twitter   RSS feed   Donate

This entry was posted in miscellany, system and tagged , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.