コード例 #1
0
ファイル: ShellHook.cs プロジェクト: madebysoren/NooSphere
        public void InitShellEvents()
        {
            try
            {
                hookWin = new NativeWindowEx();
                hookWin.CreateHandle(new CreateParams());

                //Register to receive shell-related events
                if (User32.RegisterShellHookWindow(hookWin.Handle) == false)
                {
                    throw new System.ComponentModel.Win32Exception();
                }
                else
                {
                    //No error occurred
                    WM_SHELLHOOKMESSAGE = User32.RegisterWindowMessage("SHELLHOOK");
                    hookWin.MessageRecieved += ShellWinProc;
                }
            }
            catch (Exception ex)
            {
                Debug.Print(ex.Message);
                throw ex;
            }
        }
コード例 #2
0
ファイル: KeyboardHook.cs プロジェクト: madebysoren/NooSphere
 public KeyboardHook()
 {
     hotKeyWin = new NativeWindowEx();
     hotKeyWin.CreateHandle(new System.Windows.Forms.CreateParams());
     hotKeyWin.MessageRecieved += new NativeWindowEx.MessageRecievedEventHandler(hotKeyWin_MessageRecieved);
 }