Пример #1
0
        public void Start()
        {
            if (!IsStarted)
            {
                AssignHandle(_parentHandle);

                CBTHook.Start();
                MouseLLHook.Start();
                KeyboardLLHook.Start();

                IntPtr    handle    = IntPtr.Zero;
                string    name      = string.Empty;
                LoginType loginType = LoginType.Radmin;
                WindowsApi.EnumChildWindows(IntPtr.Zero, (hwnd, lParam) =>
                {
                    if (IsLoginWindows(hwnd))
                    {
                        handle       = hwnd;
                        string title = GetHandleText(handle);
                        loginType    = GetLoginType(title);
                        name         = RemoveStringPreFlag(title);
                        return(false);
                    }
                    return(true);
                }, IntPtr.Zero);

                if (handle != IntPtr.Zero)
                {
                    OnPaddingProcess(handle, name, loginType);
                }

                IsStarted = true;
            }
        }
Пример #2
0
 public void Stop()
 {
     if (IsStarted)
     {
         CBTHook.Stop();
         MouseLLHook.Stop();
         KeyboardLLHook.Stop();
         ReleaseHandle();
         IsStarted = false;
     }
 }
Пример #3
0
        public RadminInput(IntPtr parentHandle)
        {
            _parentHandle = parentHandle;

            CBTHook        = new CBTHook(_parentHandle);
            MouseLLHook    = new MouseLLHook(_parentHandle);
            KeyboardLLHook = new KeyboardLLHook(_parentHandle);

            CBTHook.Activate       += CBTHook_Activate;
            MouseLLHook.MouseUp    += MouseLLHook_MouseUp;
            KeyboardLLHook.KeyDown += KeyboardLLHook_KeyDown;
            CBTHook.DestroyWindow  += CBTHook_DestroyWindow;
        }
Пример #4
0
        protected override void WndProc(ref Message m)
        {
            // Check to see if we've received any Windows messages telling us about our hooks
            if (KeyboardLLHook != null)
            {
                KeyboardLLHook.ProcessWindowMessage(ref m);
            }
            if (MouseLLHook != null)
            {
                MouseLLHook.ProcessWindowMessage(ref m);
            }
            if (CBTHook != null)
            {
                CBTHook.ProcessWindowMessage(ref m);
            }

            base.WndProc(ref m);
        }