Task switch
Hello,
I'm new to c#, but I need to implement a utility that can switch between applications like the classic ALT+TAB, but I need to offer them in a specially formatted list.
Can anyone suggest available sampe codes/tutorials for: i, obtaining the list of running applications, ii, how to activate the selected one?
Thanks in advance,
Gyorgy
Jan MontanoPosted Jul 8, 2007, 11:46 PM
Source: http://www.howtogeek.com/howto/programming/get-a-list-of-running-processes-in-c/
using System.Diagnostics;
Process[] processlist = Process.GetProcesses();
}
To activate window:
Source: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1806180&SiteID=1
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool SetForegroundWindow(IntPtr hWnd);
Process proc = this.procs[this.listBox1.SelectedIndex];
IntPtr ha = proc.MainWindowHandle;
if (ha != IntPtr.Zero)
{
}