SafeNativeMethods.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System.Runtime.InteropServices;
  2. namespace InABox.WPF
  3. {
  4. public sealed class SafeNativeMethods
  5. {
  6. [Flags]
  7. public enum SetWindowPosFlags : uint
  8. {
  9. SWP_NOACTIVATE = 0x0010,
  10. SWP_NOMOVE = 0x0002,
  11. SWP_NOSIZE = 0x0001
  12. }
  13. public const int WS_EX_NOACTIVATE = 0x08000000;
  14. public const int ULW_ALPHA = 0x00000002;
  15. public const int AC_SRC_OVER = 0x00000000;
  16. public const int AC_SRC_ALPHA = 0x00000001;
  17. public static readonly IntPtr HWND_TOP = new(0);
  18. [DllImport("user32.dll", ExactSpelling = true, SetLastError = true)]
  19. public static extern bool UpdateLayeredWindow(IntPtr hwnd, IntPtr hdcDst, IntPtr pptDst, IntPtr psize, IntPtr hdcSrc, IntPtr pptSrc,
  20. uint crKey,
  21. [In] ref BLENDFUNCTION pblend, uint dwFlags);
  22. [DllImport("user32.dll", ExactSpelling = true, SetLastError = true)]
  23. [return: MarshalAs(UnmanagedType.Bool)]
  24. public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, SetWindowPosFlags uFlags);
  25. public struct BLENDFUNCTION
  26. {
  27. public byte BlendOp;
  28. public byte BlendFlags;
  29. public byte SourceConstantAlpha;
  30. public byte AlphaFormat;
  31. }
  32. }
  33. }