Wednesday, 7 July 2010

HIDE MINIMIZE AND MAXIMIZE BUTTONS

  1. internal static class WindowExtensions
  2. {
  3. [DllImport("user32.dll")]
  4. internal extern static int SetWindowLong(IntPtr hwnd, int index, int value);
  5. [DllImport("user32.dll")]
  6. internal extern static int GetWindowLong(IntPtr hwnd, int index);
  7. internal static void HideMinimizeAndMaximizeButtons(this Window window)
  8. {
  9. const int GWL_STYLE = -16;
  10. IntPtr hwnd = new System.Windows.Interop.WindowInteropHelper(window).Handle;
  11. long value = GetWindowLong(hwnd, GWL_STYLE);
  12. SetWindowLong(hwnd, GWL_STYLE, (int)(value & -131073 & -65537));
  13. }
  14. }
  15. this.SourceInitialized += (x, y) =>
  16. {
  17. this.HideMinimizeAndMaximizeButtons();
  18. };

No comments:

Post a Comment