ACAT.Lib.Core.Utility.User32Interop.SendMessage C# (CSharp) Метод

SendMessage() приватный Метод

private SendMessage ( IntPtr hWnd, int msg, int wParam, int lParam ) : IntPtr
hWnd System.IntPtr
msg int
wParam int
lParam int
Результат System.IntPtr
        public static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, int lParam);

Usage Example

Пример #1
0
        /// <summary>
        /// Gets the icon associated with the specified window
        /// </summary>
        /// <param name="winHandle">window handle</param>
        /// <returns>the icon, null if it can't find one</returns>
        public static Icon GetAppIcon(IntPtr winHandle)
        {
            Log.Debug("hWnd=" + winHandle);

            IntPtr hIcon = User32Interop.SendMessage(winHandle, WM_GETICON, ICON_BIG, 0);

            if (hIcon == IntPtr.Zero)
            {
                hIcon = User32Interop.SendMessage(winHandle, WM_GETICON, ICON_SMALL, 0);
                if (hIcon == IntPtr.Zero)
                {
                    hIcon = User32Interop.SendMessage(winHandle, WM_GETICON, ICON_SMALL2, 0);
                    if (hIcon == IntPtr.Zero)
                    {
                        hIcon = getClassLongPtr(winHandle, GCL_HICON);
                        if (hIcon == IntPtr.Zero)
                        {
                            hIcon = getClassLongPtr(winHandle, GCL_HICONSM);
                            if (hIcon == IntPtr.Zero)
                            {
                                return(null);
                            }
                        }
                    }
                }
            }

            Icon icon = null;

            if (hIcon != IntPtr.Zero)
            {
                icon = Icon.FromHandle(hIcon);
            }

            return(icon);
        }