internal static extern bool GetWindowPlacement(IntPtr hWnd, ref WindowPlacement lpwndpl);
Esempio n. 2
0
        private void RestoreOnShow(object sender, WindowInfoEventArgs e)
        {
            WindowPlacement windowplacement = new WindowPlacement();
            ExternalReferences.GetWindowPlacement(this.Handle, ref windowplacement);
            WindowPattern windowPattern =
                (WindowPattern) this.AutomationElement.GetCurrentPattern(WindowPattern.Pattern);
            WindowVisualState visualState = ((windowplacement.flags & (int) WindowPlacementFlags.RestoreToMaximize) > 0)
                ? WindowVisualState.Maximized
                : WindowVisualState.Normal;
            windowPattern.SetWindowVisualState(visualState);

            this.Restored?.Invoke(sender, new WindowInfoEventArgs(this));
        }
 private static WindowPlacement GetPlacement(IntPtr hwnd)
 {
     WindowPlacement placement = new WindowPlacement();
     placement.length = Marshal.SizeOf(placement);
     GetWindowPlacement(hwnd, ref placement);
     return placement;
 }
 internal static WindowPlacement GetWindowPlacement(IntPtr hWnd)
 {
     return(WindowPlacement.Load(hWnd));
 }