Beispiel #1
0
        public static IntPtr GetAppIcon(Window wnd, int index)
        {
            IntPtr hwnd       = wnd.Handle;
            IntPtr iconHandle = IntPtr.Zero;

            if (index == 0)
            {
                iconHandle = User32.SendMessage(hwnd, User32.WM_GETICON, User32.ICON_SMALL2, 0);
            }
            if (index == 1)
            {
                iconHandle = User32.SendMessage(hwnd, User32.WM_GETICON, User32.ICON_SMALL, 0);
            }
            if (index == 2)
            {
                iconHandle = User32.SendMessage(hwnd, User32.WM_GETICON, User32.ICON_BIG, 0);
            }
            if (index == 3)
            {
                iconHandle = Taskbar.GetClassLongPtr(hwnd, User32.GCL_HICONSM);
            }
            if (index == 4)
            {
                iconHandle = Taskbar.GetClassLongPtr(hwnd, User32.GCL_HICON);
            }
            return(iconHandle);
        }