public Overlay(Process process) { this.process = process; this.handle = base.Handle; int windowLong = Managed.GetWindowLong(base.Handle, -20); Managed.SetWindowLong(base.Handle, -20, (windowLong | 0x80000) | 0x20); IntPtr hWndInsertAfter = new IntPtr(-1); Managed.SetWindowPos(base.Handle, hWndInsertAfter, 0, 0, 0, 0, 3); this.OnResize(null); this.InitializeComponent(); }
// Init public Overlay(Process process) { this.process = process; this.handle = Handle; int initialStyle = Managed.GetWindowLong(this.Handle, -20); Managed.SetWindowLong(this.Handle, -20, initialStyle | 0x80000 | 0x20); IntPtr HWND_TOPMOST = new IntPtr(-1); const UInt32 SWP_NOSIZE = 0x0001; const UInt32 SWP_NOMOVE = 0x0002; const UInt32 TOPMOST_FLAGS = SWP_NOMOVE | SWP_NOSIZE; Managed.SetWindowPos(this.Handle, HWND_TOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS); OnResize(null); InitializeComponent(); }