protected SystemWindow (IntPtr handle, EmbeddingOptions options) { Handle = handle; _handleRef = new HandleRef(this, Handle); _originalStyle = WinAPI.GetWindowLongPtr(Handle, WinAPI.GWL.STYLE); _originalExStyle = WinAPI.GetWindowLongPtr(Handle, WinAPI.GWL.EXSTYLE); WinAPI.RECT rect; WinAPI.GetWindowRect(_handleRef, out rect); _originalPosition = new WinAPI.Position(rect); _embeddingOptions = options; }
void SetOriginalStyle () { WinAPI.RECT rect; WinAPI.GetWindowRect(_handleRef, out rect); WinAPI.Position pos = new WinAPI.Position(rect); Visible = false; WinAPI.SetWindowLongPtr(new HandleRef(this, Handle), WinAPI.GWL.STYLE, new UIntPtr(_originalStyle)); WinAPI.SetWindowLongPtr(new HandleRef(this, Handle), WinAPI.GWL.EXSTYLE, new UIntPtr(_originalExStyle)); _embeddable = false; Visible = true; WinAPI.SetWindowPos(Handle, WinAPI.HWND.TOP, pos.X, pos.Y, pos.Width, pos.Height, WinAPI.SWP.NOZORDER); }