/// ----------------------------------------------------------------------------------------
        /// <summary>
        /// Get Process Icon.
        /// </summary>
        /// <returns>Process Icon</returns>
        /// ----------------------------------------------------------------------------------------
        public static Image GetSmallWindowIcon(IntPtr hWnd)
        {
            try
            {
                try
                {
                    Process process = hWnd.GetProcess();  // Process.GetProcesses(); if you dont have.
                    string fullPath = process.Modules[0].FileName;
                    return Icon.ExtractAssociatedIcon(fullPath).ToBitmap();
                }
                catch
                {
                }

                IntPtr hIcon = default(IntPtr);

                hIcon = SendMessage(hWnd, WM_GETICON, ICON_SMALL2, IntPtr.Zero);

                if (hIcon == IntPtr.Zero)
                    hIcon = GetClassLongPtr(hWnd, GCL_HICON);

                if (hIcon == IntPtr.Zero)
                    hIcon = LoadIcon(IntPtr.Zero, (IntPtr)0x7F00/*IDI_APPLICATION*/);

                if (hIcon != IntPtr.Zero)
                    return new Bitmap(Icon.FromHandle(hIcon).ToBitmap(), 32, 32);
                else
                    return null;
            }
            catch (Exception)
            {
                return null;
            }
        }