コード例 #1
0
ファイル: IconManager.cs プロジェクト: tcgm/clever-dock
        public static BitmapSource GetAppIcon(IntPtr hwnd)
        {
            IntPtr hIcon = WI.GetClassLongPtr(hwnd, WI.ICON_SMALL);

            try
            {
                if (hIcon == IntPtr.Zero)
                {
                    hIcon = WI.SendMessage(hwnd, WindowMessage.GETICON, WI.ICON_SMALL2, 0);
                }
                if (hIcon == IntPtr.Zero)
                {
                    hIcon = WI.SendMessage(hwnd, WindowMessage.GETICON, WI.ICON_BIG, 0);
                }
                if (hIcon == IntPtr.Zero)
                {
                    hIcon = WI.GetClassLongPtr(hwnd, WI.GCL_HICON);
                }
                if (hIcon == IntPtr.Zero)
                {
                    hIcon = WI.GetClassLongPtr(hwnd, WI.GCL_HICONSM);
                }
            }
            catch (Exception ex)
            { }
            if (hIcon == IntPtr.Zero)
            {
                return(null);
            }
            var bs = IconSource(hIcon);

            return(bs);
        }
コード例 #2
0
ファイル: Win32Window.cs プロジェクト: tcgm/clever-dock
 public void Close()
 {
     WindowInterop.SendMessage(Hwnd, WindowMessage.CLOSE, 0, 0);
 }