Example #1
0
        public static void SetWindowPlacement(IntPtr windowHandle, String placementBase64String)
        {
            try
            {
                var bytes = Convert.FromBase64String(placementBase64String);

                var windowPlacement = SerializeTool.Deserialize <WINDOWPLACEMENT>(bytes);

                windowPlacement.length  = (UInt32)Marshal.SizeOf(typeof(WINDOWPLACEMENT));
                windowPlacement.flags   = 0;
                windowPlacement.showCmd = (windowPlacement.showCmd == SW_SHOWMINIMIZED ? SW_SHOWNORMAL : windowPlacement.showCmd);

                SetWindowPlacement(windowHandle, ref windowPlacement);
            }
            catch { }
        }
Example #2
0
        public static String GetWindowPlacement(IntPtr windowHandle)
        {
            try
            {
                WINDOWPLACEMENT windowPlacement = new WINDOWPLACEMENT();
                if (!GetWindowPlacement(windowHandle, out windowPlacement))
                {
                    return("");
                }

                var bytes = SerializeTool.Serialize(windowPlacement);

                return(Convert.ToBase64String(bytes));
            }
            catch
            {
                return("");
            }
        }