Пример #1
0
        private void GetIcons()
        {
            // theoretically one could broadcast a "TaskbarCreated" message so that windows resend their icons, but it doesn't work very well

            foreach (var icon in SystemTray.GetButtons(SystemAndProcessInformation.trayHandle))
            {
                var pictureBox = CreatePictureBox(icon);
                var toolTip    = CreateToolTip(pictureBox, icon.tooltip);
                icons[Tuple.Create((int)icon.hWnd, icon.id)] = Tuple.Create(icon, pictureBox, toolTip);
            }

            if (showFullSystemTray)
            {
                HiddenIconAdded += OnIconAdded;

                foreach (var icon in SystemTray.GetButtons(SystemAndProcessInformation.hiddenTrayHandle))
                {
                    var pictureBox = CreatePictureBox(icon);
                    var toolTip    = CreateToolTip(pictureBox, icon.tooltip);
                    icons[Tuple.Create((int)icon.hWnd, icon.id)] = Tuple.Create(icon, pictureBox, toolTip);
                }
            }
        }