Ejemplo n.º 1
0
 public static WINDOWPLACEMENT GetWindowPlacement(IntPtr handle)
 {
   // Persist window placement details to application settings
   var wp = new WINDOWPLACEMENT();
   GetWindowPlacement(handle, out wp);
   return wp;
 }
Ejemplo n.º 2
0
    public static void SetWindowPlacement(IntPtr handle, WINDOWPLACEMENT placement)
    {
      try
      {
        // Load window placement details for previous application session from application settings
        // Note - if window was closed on a monitor that is now disconnected from the computer,
        //        SetWindowPlacement will place the window onto a visible monitor.
        WINDOWPLACEMENT wp = placement;
        wp.length = Marshal.SizeOf(typeof(WINDOWPLACEMENT));
        wp.flags = 0;
        wp.showCmd = (wp.showCmd == SW_SHOWMINIMIZED ? SW_SHOWNORMAL : wp.showCmd);
        SetWindowPlacement(handle, ref wp);
      }
      catch { }

    }
Ejemplo n.º 3
0
 public static extern bool GetWindowPlacement(IntPtr hWnd, out WINDOWPLACEMENT lpwndpl);