private static extern bool GetWindowPlacement(IntPtr hWnd, out WINDOWPLACEMENT lpwndpl);
public static string GetPlacement(IntPtr windowHandle) { WINDOWPLACEMENT placement = new WINDOWPLACEMENT(); GetWindowPlacement(windowHandle, out placement); using (var memoryStream = new MemoryStream()) { using (var xmlTextWriter = new XmlTextWriter(memoryStream, Encoding.UTF8)) { serializer.Serialize(xmlTextWriter, placement); byte[] xmlBytes = memoryStream.ToArray(); return encoding.GetString(xmlBytes); } } }