Example #1
1
		static extern void DwmSetWindowAttribute (IntPtr hwnd, DwmWindowAttribute attr, ref int attrValue, int attrSize);
Example #2
0
        public static int DwmGetWindowAttribute <T>(IntPtr hwnd, DwmWindowAttribute dwAttribute, out T pvAttribute)
        {
            int result = 0;

            pvAttribute = default(T);

            int size = Marshal.SizeOf(pvAttribute);

            var ptr = Marshal.AllocHGlobal(size);

            try
            {
                Marshal.StructureToPtr(pvAttribute, ptr, false);

                result = DwmGetWindowAttribute(hwnd, dwAttribute, ptr, size);

                pvAttribute = (T)Marshal.PtrToStructure(ptr, pvAttribute.GetType());
            }
            finally
            {
                Marshal.FreeHGlobal(ptr);
            }

            return(result);
        }
Example #3
0
        // Safe method of calling dwmapi.dll, for versions of Windows lower than Vista
        internal static int DwmGetWindowAttribute(IntPtr hWnd,
                                                  DwmWindowAttribute dwAttribute,
                                                  ref WindowsRect pvAttribute,
                                                  int cbAttribute)
        {
            IntPtr dwmDll = LoadLibrary("dwmapi.dll");

            if (dwmDll == IntPtr.Zero)
            {
                return(Marshal.GetLastWin32Error());
            }
            IntPtr dwmFunction = GetProcAddress(dwmDll, "DwmGetWindowAttribute");

            if (dwmFunction == IntPtr.Zero)
            {
                return(Marshal.GetLastWin32Error());
            }
            var call =
                (DwmGetWindowAttributeDelegate)
                Marshal.GetDelegateForFunctionPointer(dwmFunction,
                                                      typeof(
                                                          DwmGetWindowAttributeDelegate
                                                          ));
            int result = call(hWnd, dwAttribute, ref pvAttribute, cbAttribute);

            FreeLibrary(dwmDll);
            return(result);
        }
Example #4
0
 /// <summary>
 /// Sets the value of non-client rendering attributes for a window.
 /// </summary>
 /// <param name="hwnd">The handle to the window that will receive the attributes.</param>
 /// <param name="attribute">A single DWMWINDOWATTRIBUTE flag to apply to the window. This parameter specifies the attribute and the pvAttribute parameter points to the value of that attribute.</param>
 /// <param name="attributeValue">The value of the attribute specified in the attribute parameter. Different DWMWINDOWATTRIBUTE flags require different value types.</param>
 /// <param name="attributeSize">The size, in bytes, of the value type pointed to by the pvAttribute parameter.</param>
 /// <returns></returns>
 public static bool SetWindowAttribute(IntPtr hwnd, DwmWindowAttribute attribute, int attributeValue, uint attributeSize)
 {
     if (IsPlatformSupported)
     {
         return(NativeMethods.DwmSetWindowAttribute(hwnd, attribute, ref attributeValue, attributeSize).Succeeded);
     }
     return(false);
 }
Example #5
0
 static extern void DwmSetWindowAttribute(IntPtr hwnd, DwmWindowAttribute attr, ref int attrValue, int attrSize);
 protected static extern int DwmSetWindowAttribute(IntPtr hwnd, DwmWindowAttribute attr, IntPtr attrValue, int attrSize);
Example #7
0
 public static extern HRESULT DwmSetWindowAttribute(IntPtr hwnd, DwmWindowAttribute dwAttribute,
     ref int attribute, uint cbAttribute);
Example #8
0
 public static extern int DwmGetWindowAttribute(IntPtr hwnd, DwmWindowAttribute dwAttribute, out RECT pvAttribute, int cbAttribute);
Example #9
0
 public static extern int DwmSetWindowAttribute(IntPtr hwnd, DwmWindowAttribute dwAttribute, ref int pvAttribute, int cbAttribute);
 private static extern int DwmSetWindowAttribute(IntPtr hwnd,
                                                DwmWindowAttribute dwmAttribute,
                                                IntPtr pvAttribute,
                                                uint cbAttribute);
Example #11
0
 // Safe method of calling dwmapi.dll, for versions of Windows lower than Vista
 internal static int DwmGetWindowAttribute(IntPtr hWnd, DwmWindowAttribute dwAttribute, ref WindowsRect pvAttribute, int cbAttribute)
 {
     IntPtr dwmDll = LoadLibrary("dwmapi.dll");
     if (dwmDll == IntPtr.Zero)
         return Marshal.GetLastWin32Error();
     IntPtr dwmFunction = GetProcAddress(dwmDll, "DwmGetWindowAttribute");
     if (dwmFunction == IntPtr.Zero)
         return Marshal.GetLastWin32Error();
     var call = (DwmGetWindowAttributeDelegate)Marshal.GetDelegateForFunctionPointer(dwmFunction, typeof(DwmGetWindowAttributeDelegate));
     int result = call(hWnd, dwAttribute, ref pvAttribute, cbAttribute);
     FreeLibrary(dwmDll);
     return result;
 }
Example #12
0
 public static extern int DwmSetWindowAttribute(
     [In] IntPtr hwnd,
     [In] DwmWindowAttribute dwAttribute,
     [In][Out] ref IntPtr pvAttribute,
     [In] int cbAttribute);
Example #13
0
 public static extern int DwmGetWindowAttribute(
     [In] IntPtr hwnd,
     [In] DwmWindowAttribute dwAttribute,
     [Out] out RECT pvAttribute,
     [In] int cbAttribute);
Example #14
0
 public static IntPtr DwmGetWindowAttribute(IntPtr hwnd, DwmWindowAttribute dwAttribute, void *pvAttribute, int cbAttribute);
Example #15
0
 internal static extern void DwmGetWindowAttribute(IntPtr hwnd, DwmWindowAttribute dwAttribute, out Rectangle pvAttribute, int cbAttribute);
Example #16
0
 internal static extern int DwmSetWindowAttribute(IntPtr window, DwmWindowAttribute attribute, IntPtr valuePointer, int valuePointerSize);
Example #17
0
 unsafe public static extern HRESULT DwmGetWindowAttribute(HWND hwnd, DwmWindowAttribute dwAttribute, void* pvAttribute, DWORD cbAttribute);
Example #18
0
 private static int DwmSetIntAttribute(IntPtr hwnd, DwmWindowAttribute att, int v)
 {
     return(DwmSetWindowAttribute(hwnd, att, ref v, Marshal.SizeOf(typeof(int))));
 }
Example #19
0
 private static extern int DwmSetWindowAttribute(IntPtr hwnd, DwmWindowAttribute dwmAttribute, IntPtr pvAttribute, uint cbAttribute);
Example #20
0
 public static extern HRESULT DwmSetWindowAttribute(IntPtr hwnd, DwmWindowAttribute dwAttribute,
                                                    ref int attribute, uint cbAttribute);
Example #21
0
        private static int DwmSetBoolAttribute(IntPtr hwnd, DwmWindowAttribute att, bool v)
        {
            int iV = v ? 1 : 0;

            return(DwmSetWindowAttribute(hwnd, att, ref iV, Marshal.SizeOf(typeof(int))));
        }
Example #22
0
 internal static extern int DwmSetWindowAttribute(IntPtr hwnd,
                                                  DwmWindowAttribute dwmAttribute,
                                                  ref int pvAttribute,
                                                  uint cbAttribute);
Example #23
0
 public static IntPtr DwmGetWindowAttribute(IntPtr hwnd, DwmWindowAttribute dwAttribute, void* pvAttribute, int cbAttribute);
Example #24
0
 internal static extern int DwmGetWindowAttribute(IntPtr hWnd,
     DwmWindowAttribute dwAttribute,
     ref WindowsRect pvAttribute,
     int cbAttribute);
Example #25
0
 internal static extern int DwmSetWindowAttribute(IntPtr hwnd,
                                                DwmWindowAttribute dwmAttribute,
                                                ref int pvAttribute,
                                                uint cbAttribute);
Example #26
0
 public static extern int DwmGetWindowAttribute(IntPtr windowHandle, DwmWindowAttribute attribute, out Rect pvAttribute, int cbAttribute);
Example #27
0
 public static extern int DwmSetWindowAttribute(IntPtr hwnd, DwmWindowAttribute dwAttribute, ref int pvAttribute, int cbAttribute);
Example #28
0
 /// <summary>
 /// Sets the value of non-client rendering attributes for a window.
 /// </summary>
 /// <param name="hwnd">The handle to the window that will receive the attributes.</param>
 /// <param name="attribute">A single DWMWINDOWATTRIBUTE flag to apply to the window. This parameter specifies the attribute and the pvAttribute parameter points to the value of that attribute.</param>
 /// <param name="attributeValue">The value of the attribute specified in the attribute parameter. Different DWMWINDOWATTRIBUTE flags require different value types.</param>
 /// <param name="attributeSize">The size, in bytes, of the value type pointed to by the pvAttribute parameter.</param>
 /// <returns></returns>
 public static bool SetWindowAttribute(IntPtr hwnd, DwmWindowAttribute attribute, int attributeValue, uint attributeSize)
 {
     if (IsPlatformSupported)
     {
         return NativeMethods.DwmSetWindowAttribute(hwnd, attribute, ref attributeValue, attributeSize).Succeeded;
     }
     return false;
 }
Example #29
0
 public static extern void DwmSetWindowAttribute(IntPtr windowHandle, DwmWindowAttribute atrribute, ref int attributeValue, int attributeSize);
Example #30
0
 static extern int DwmGetWindowAttribute(IntPtr hwnd, DwmWindowAttribute attribute, out Win32Rect value, int valueSize);
Example #31
0
 public static extern int DwmSetWindowAttribute(Hwnd hwnd, DwmWindowAttribute attr, ref int attrValue, int attrSize);
Example #32
0
 internal static extern int DwmGetWindowAttribute(IntPtr hwnd, DwmWindowAttribute dwAttribute, out bool pvAttribute, int cbAttribute);
Example #33
0
 public static extern void DwmSetWindowAttribute( IntPtr windowHandle, DwmWindowAttribute atrribute, ref int attributeValue, int attributeSize );
Example #34
0
 public static extern int DwmGetWindowAttribute(IntPtr windowHandle, DwmWindowAttribute dwAttribute, out Rectangle lpRect, int cbAttribute);
Example #35
0
		static extern int DwmGetWindowAttribute (IntPtr hwnd, DwmWindowAttribute attribute, out Win32Rect value, int valueSize);
Example #36
0
 internal static extern int DwmSetWindowAttribute(IntPtr hwnd, DwmWindowAttribute attr, ref int attrValue, uint attrSize);
 public static int SetWindowAttribute(IntPtr hwnd, DwmWindowAttribute attribute, int parameter)
 => DwmSetWindowAttribute(hwnd, attribute, ref parameter, Marshal.SizeOf <int>());