I am trying to create a taskbar replacement, and I want a button for each running application.
public void AddBtn(string name) {
Button newButton = new Button();
this.Controls.Add(newButton);
newButton.Location = new Point(count * 75, Screen.PrimaryScreen.Bounds.Height - 25);
newButton.Text = name;
newButton.Name = count.ToString();
newButton.BringToFront();
count++;
}
private void GetRunning()
{
Process[] processes = Process.GetProcesses();
foreach (Process process in Process.GetProcesses().Where(p => !string.IsNullOrEmpty(p.MainWindowTitle)).ToList())
AddBtn(process.ProcessName);
}
This is what I have so far, it creates a button for each running application. I need to detect if one of the applications close, so I can remove the button that corresponds with it. If you think there is a better way to do it, let me know.
ShowInTaskbarset tofalse). S. web.archive.org/web/20110123054624/http://msdn.microsoft.com/…