Exemple #1
0
        static public void GetIconFromTB(IntPtr _ToolbarWindowHandle, ref List <Tuple <string, string> > results)
        {
            UInt32 count = (uint)User32.SendMessage(_ToolbarWindowHandle, User32.TB.BUTTONCOUNT, 0, 0);

            for (int i = 0; i < count; i++)
            {
                TBBUTTON tbButton       = new TBBUTTON();
                string   text           = String.Empty;
                IntPtr   ipWindowHandle = IntPtr.Zero;
                Tray.GetTBButton(_ToolbarWindowHandle, i, ref tbButton, ref text, ref ipWindowHandle);
                string procName;
                try
                {
                    uint pid = 0;
                    GetWindowThreadProcessId(ipWindowHandle, out pid);
                    Process proc = Process.GetProcessById((int)pid);
                    procName = proc.ProcessName.ToString();
                }
                catch
                {
                    procName = "--";
                }

                results.Add(new Tuple <string, string>(procName, text));
            }
        }
Exemple #2
0
 string getTray(string process)
 {
     if (chkTray.Checked)
     {
         foreach (var i in Tray.GetTrayIcons())
         {
             if (i.Item1.ToLower() == process.ToLower() && i.Item2.Length > 0)
             {
                 return(i.Item2);
             }
         }
     }
     if (chkCollapse.Checked)
     {
         foreach (var i in Tray.GetCollapsedTrayIcons())
         {
             if (i.Item1.ToLower() == process.ToLower() && i.Item2.Length > 0)
             {
                 return(i.Item2);
             }
         }
     }
     if (chkTaskbar.Checked)
     {
         foreach (var i in Tray.GetTaskbarIcons())
         {
             if (i.Item1.ToLower() == process.ToLower() && i.Item2.Length > 0)
             {
                 return(i.Item2);
             }
         }
     }
     return("");
 }