/// <summary>
        /// Gets the path of the color profile for the monitor containing the specified window handle.
        /// </summary>
        /// <param name="hwnd">The window handle for which to retrieve the color profile.</param>
        /// <returns>
        /// A string containing the color profile for the monitor; or null if no color profile is assigned.
        /// </returns>
        internal static string GetMonitorColorProfilePath(IntPtr hwnd)
        {
            string profile = null;

            IntPtr hMonitor = SafeNativeMethods.MonitorFromWindow(hwnd, NativeConstants.MONITOR_DEFAULTTONEAREST);

            NativeStructs.MONITORINFOEX monitorInfo = new NativeStructs.MONITORINFOEX
            {
                cbSize = (uint)Marshal.SizeOf(typeof(NativeStructs.MONITORINFOEX))
            };

            if (SafeNativeMethods.GetMonitorInfo(hMonitor, ref monitorInfo))
            {
                using (SafeDCHandle hdc = SafeNativeMethods.CreateDC(monitorInfo.szDeviceName, monitorInfo.szDeviceName, null, IntPtr.Zero))
                {
                    if (!hdc.IsInvalid)
                    {
                        uint size = 0;
                        SafeNativeMethods.GetICMProfile(hdc, ref size, null);

                        if (size > 0)
                        {
                            StringBuilder builder = new StringBuilder((int)size);

                            if (SafeNativeMethods.GetICMProfile(hdc, ref size, builder))
                            {
                                profile = builder.ToString();
                            }
                        }
                    }
                }
            }

            return(profile);
        }
 internal static extern bool GetMonitorInfo(IntPtr hMonitor, ref NativeStructs.MONITORINFOEX lpmi);