Пример #1
0
 public WindowFocusWatcher(WindowFocusWatcherEvent e)
 {
     _event = e;
     _delegate = WinEventProc;
     _hook = Native.SetWinEventHook(Native.EVENT_OBJECT_FOCUS, Native.EVENT_OBJECT_FOCUS, IntPtr.Zero,
         _delegate, 0, 0, Native.WINEVENT_OUTOFCONTEXT);
 }
Пример #2
0
        public OverlayForm()
        {
            this.FormBorderStyle = FormBorderStyle.None;
            this.StartPosition   = FormStartPosition.Manual;
            this.TopMost         = true;
            this.ControlBox      = false;
            this.ShowInTaskbar   = false;
            this.BackColor       = Color.FromArgb(1, 2, 3); // some exotic color
            this.TransparencyKey = this.BackColor;

            this.pen = new Pen(Color.Red, BoundFrameWidth)
            {
                Alignment = PenAlignment.Inset
            };

            this.procDelegate = this.ProcDelegate;
            this.winEventHook = Native.SetWinEventHook(
                Native.EVENT_SYSTEM_FOREGROUND,
                Native.EVENT_OBJECT_CREATE,
                IntPtr.Zero,
                this.procDelegate,
                0,
                0,
                Native.WINEVENT_OUTOFCONTEXT);
        }
Пример #3
0
 public WindowFocusWatcher(WindowFocusWatcherEvent e)
 {
     _event    = e;
     _delegate = WinEventProc;
     _hook     = Native.SetWinEventHook(Native.EVENT_OBJECT_FOCUS, Native.EVENT_OBJECT_FOCUS, IntPtr.Zero,
                                        _delegate, 0, 0, Native.WINEVENT_OUTOFCONTEXT);
 }
Пример #4
0
        private TabControllerTag(Tab tab, Process process)
        {
            Tab     = tab;
            Process = process;

            Tab.Resize += Tab_Resize;

            Process.Exited += Process_Exited;
            Process.EnableRaisingEvents = true;

            _winProcDelegate = new Native.WinEventDelegate(WinEventProc);
            _hook            = Native.SetWinEventHook(Native.EVENT_OBJECT_NAMECHANGE, Native.EVENT_OBJECT_NAMECHANGE, IntPtr.Zero, _winProcDelegate, (uint)process.Id, 0, Native.WINEVENT_OUTOFCONTEXT);
        }
Пример #5
0
            public MessageWindow()
            {
                window = this;
                handle = Handle;

                // thread of MessageWindow would be a separate dllhost.exe
                // process started by the OneNote process (with SysWOW64 in its command line)
                msgThreadId = Native.GetWindowThreadProcessId(handle, out _);

                // maintain a ref so GC doesn't remove it and cause exceptions
                evDelegate = new Native.WinEventDelegate(WinEventProc);
                gch        = GCHandle.Alloc(evDelegate);

                // set up event hook to monitor switching application
                Native.SetWinEventHook(
                    Native.EVENT_SYSTEM_FOREGROUND,
                    Native.EVENT_SYSTEM_MINIMIZEEND,
                    IntPtr.Zero,
                    evDelegate,
                    0, 0, Native.WINEVENT_OUTOFCONTEXT | Native.WINEVENT_SKIPOWNTHREAD);

                resetEvent.Set();
            }
Пример #6
0
 public static void Subscribe()
 {
     _dele   = WinEventProc;
     _mHhook = Native.SetWinEventHook(EventSystemForeground, EventSystemForeground, IntPtr.Zero, _dele, 0, 0, WineventOutofcontext);
 }
Пример #7
0
 private void SetupTabActivateHandler()
 {
     _tabActivate += TabActivateEventHandler;
 }
Пример #8
0
 public GlobalHook()
 {
     _hookDelegate = WinEventProc;
 }