private void button1_Click(object sender, EventArgs e) { label1.Text = Steam.process.ProcessName + " " + Steam.process.Handle; ProcessThreadCollection sc = Steam.process.Threads; foreach (Process proc in Process.GetProcesses()) { if (proc.ProcessName.ToLower().Contains("steam")) { try { IntPtr trayApp = TrayUtility.FindWindow(null, proc.ProcessName); //TrayUtility.ShowWindow(trayApp, 1); NotifyIconData pnid = new NotifyIconData(); pnid.uCallbackMessage = 0x800; pnid.uFlags = 1; pnid.hwnd = trayApp; pnid.uID = 1; pnid.hIcon = IntPtr.Zero; pnid.szTip = null; pnid.uFlags |= 2; label1.Text += "\n" + TrayUtility.Shell_NotifyIcon(2, ref pnid) + " "; label1.Text += proc.ProcessName + " " + pnid.hwnd + " " + trayApp; } catch { label1.Text += "\n" + proc.ProcessName + " Failed"; } } } //NotifyIconData pnid = new NotifyIconData(); //pnid.uCallbackMessage = 0x800; //pnid.uFlags = 1; // //pnid.hwnd = Steam.process.Handle; //pnid.uID = 1; //pnid.hIcon = IntPtr.Zero; //pnid.szTip = null; //pnid.uFlags |= 2; //Steam.Shell_NotifyIcon(2, ref pnid); }
public static extern bool Shell_NotifyIcon(uint dwMessage, [In] ref NotifyIconData pnid);