Exemplo n.º 1
1
		static extern void DwmSetWindowAttribute (IntPtr hwnd, DwmWindowAttribute attr, ref int attrValue, int attrSize);
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
 }
Exemplo n.º 5
0
 static extern void DwmSetWindowAttribute(IntPtr hwnd, DwmWindowAttribute attr, ref int attrValue, int attrSize);
Exemplo n.º 6
0
 protected static extern int DwmSetWindowAttribute(IntPtr hwnd, DwmWindowAttribute attr, IntPtr attrValue, int attrSize);
Exemplo n.º 7
0
 public static extern HRESULT DwmSetWindowAttribute(IntPtr hwnd, DwmWindowAttribute dwAttribute,
     ref int attribute, uint cbAttribute);
Exemplo n.º 8
0
 public static extern int DwmGetWindowAttribute(IntPtr hwnd, DwmWindowAttribute dwAttribute, out RECT pvAttribute, int cbAttribute);
Exemplo n.º 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);
Exemplo n.º 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;
 }
Exemplo n.º 12
0
 public static extern int DwmSetWindowAttribute(
     [In] IntPtr hwnd,
     [In] DwmWindowAttribute dwAttribute,
     [In][Out] ref IntPtr pvAttribute,
     [In] int cbAttribute);
Exemplo n.º 13
0
 public static extern int DwmGetWindowAttribute(
     [In] IntPtr hwnd,
     [In] DwmWindowAttribute dwAttribute,
     [Out] out RECT pvAttribute,
     [In] int cbAttribute);
Exemplo n.º 14
0
 public static IntPtr DwmGetWindowAttribute(IntPtr hwnd, DwmWindowAttribute dwAttribute, void *pvAttribute, int cbAttribute);
Exemplo n.º 15
0
 internal static extern void DwmGetWindowAttribute(IntPtr hwnd, DwmWindowAttribute dwAttribute, out Rectangle pvAttribute, int cbAttribute);
Exemplo n.º 16
0
 internal static extern int DwmSetWindowAttribute(IntPtr window, DwmWindowAttribute attribute, IntPtr valuePointer, int valuePointerSize);
Exemplo n.º 17
0
 unsafe public static extern HRESULT DwmGetWindowAttribute(HWND hwnd, DwmWindowAttribute dwAttribute, void* pvAttribute, DWORD cbAttribute);
Exemplo n.º 18
0
 private static int DwmSetIntAttribute(IntPtr hwnd, DwmWindowAttribute att, int v)
 {
     return(DwmSetWindowAttribute(hwnd, att, ref v, Marshal.SizeOf(typeof(int))));
 }
Exemplo n.º 19
0
 private static extern int DwmSetWindowAttribute(IntPtr hwnd, DwmWindowAttribute dwmAttribute, IntPtr pvAttribute, uint cbAttribute);
Exemplo n.º 20
0
 public static extern HRESULT DwmSetWindowAttribute(IntPtr hwnd, DwmWindowAttribute dwAttribute,
                                                    ref int attribute, uint cbAttribute);
Exemplo n.º 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))));
        }
Exemplo n.º 22
0
 internal static extern int DwmSetWindowAttribute(IntPtr hwnd,
                                                  DwmWindowAttribute dwmAttribute,
                                                  ref int pvAttribute,
                                                  uint cbAttribute);
Exemplo n.º 23
0
 public static IntPtr DwmGetWindowAttribute(IntPtr hwnd, DwmWindowAttribute dwAttribute, void* pvAttribute, int cbAttribute);
Exemplo n.º 24
0
 internal static extern int DwmGetWindowAttribute(IntPtr hWnd,
     DwmWindowAttribute dwAttribute,
     ref WindowsRect pvAttribute,
     int cbAttribute);
Exemplo n.º 25
0
 internal static extern int DwmSetWindowAttribute(IntPtr hwnd,
                                                DwmWindowAttribute dwmAttribute,
                                                ref int pvAttribute,
                                                uint cbAttribute);
Exemplo n.º 26
0
 public static extern int DwmGetWindowAttribute(IntPtr windowHandle, DwmWindowAttribute attribute, out Rect pvAttribute, int cbAttribute);
Exemplo n.º 27
0
 public static extern int DwmSetWindowAttribute(IntPtr hwnd, DwmWindowAttribute dwAttribute, ref int pvAttribute, int cbAttribute);
Exemplo n.º 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;
 }
Exemplo n.º 29
0
 public static extern void DwmSetWindowAttribute(IntPtr windowHandle, DwmWindowAttribute atrribute, ref int attributeValue, int attributeSize);
Exemplo n.º 30
0
 static extern int DwmGetWindowAttribute(IntPtr hwnd, DwmWindowAttribute attribute, out Win32Rect value, int valueSize);
Exemplo n.º 31
0
 public static extern int DwmSetWindowAttribute(Hwnd hwnd, DwmWindowAttribute attr, ref int attrValue, int attrSize);
Exemplo n.º 32
0
 internal static extern int DwmGetWindowAttribute(IntPtr hwnd, DwmWindowAttribute dwAttribute, out bool pvAttribute, int cbAttribute);
Exemplo n.º 33
0
 public static extern void DwmSetWindowAttribute( IntPtr windowHandle, DwmWindowAttribute atrribute, ref int attributeValue, int attributeSize );
Exemplo n.º 34
0
 public static extern int DwmGetWindowAttribute(IntPtr windowHandle, DwmWindowAttribute dwAttribute, out Rectangle lpRect, int cbAttribute);
Exemplo n.º 35
0
		static extern int DwmGetWindowAttribute (IntPtr hwnd, DwmWindowAttribute attribute, out Win32Rect value, int valueSize);
Exemplo n.º 36
0
 internal static extern int DwmSetWindowAttribute(IntPtr hwnd, DwmWindowAttribute attr, ref int attrValue, uint attrSize);
Exemplo n.º 37
0
 public static int SetWindowAttribute(IntPtr hwnd, DwmWindowAttribute attribute, int parameter)
 => DwmSetWindowAttribute(hwnd, attribute, ref parameter, Marshal.SizeOf <int>());