Your question is not very clear but what I understand is that, you wish to focus a running process from your application.
For that below is the code which take application name as input:
using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Diagnostics;
namespace WindowsApplication1 {
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
}
[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern bool SetForegroundWindow(IntPtr hWnd);
private void button1_Click(object sender, EventArgs e) {
Process[] procs = Process.GetProcessesByName("notepad");
if (procs.Length > 0) {
if (procs[0].MainWindowHandle != IntPtr.Zero)
SetForegroundWindow(procs[0].MainWindowHandle);
}
}
}
}
Source:
http://social.msdn.microsoft.com/forums/en-US/Vsexpressvcs/thread/6573bf2a-41a1-46d2-a1c5-797c8e0bd781/[
^]