示例#1
0
 private static extern bool GetWindowPlacement(IntPtr hWnd, out WINDOWPLACEMENT lpwndpl);
示例#2
0
 public static string Save(Window window)
 {
     WINDOWPLACEMENT wp = new WINDOWPLACEMENT();
     IntPtr hwnd = new WindowInteropHelper(window).Handle;
     GetWindowPlacement(hwnd, out wp);
     int size = Marshal.SizeOf(typeof(WINDOWPLACEMENT));
     var buf = new byte[size];
     IntPtr p = Marshal.AllocHGlobal(size);
     Marshal.StructureToPtr(wp, p, true);
     Marshal.Copy(p, buf, 0, size);
     Marshal.FreeHGlobal(p);
     return Convert.ToBase64String(buf);
 }