示例#1
0
        // This is the constructor. Honestly, there needs to be a
        // constructor keyword.
        static KeyboardListener()
        {
            ListeningWindow.KeyDelegate aKeyDelegate = new ListeningWindow.KeyDelegate(KeyHandler);

            // Creates a window ... of sorts.
            s_Listener = new ListeningWindow(aKeyDelegate);
        }
示例#2
0
        public void Destroy()
        {
            // If you make AListeningWindow null before you
            // unregister, its Handle will be gone too.
            WaitForPThread.Abort();
            MonitorHotkeyPActivated.Abort();
            UnregisterHotKey(AListeningWindow.Handle, 265);
            UnregisterAllHotKeys();

            AListeningWindow = null;
            // Only use if you have a UponCreationForm.

/*
 *			if (MyControl != null)
 *				MyControl.Dispose();
 *			MyControl = null;
 */
        }
示例#3
0
        public IntPtr Create(IntPtr hwndParent)
        {
            //KeyboardListener.s_KeyEventHandler += new EventHandler(Globule.OnUniversalKeyEvent);
            ParentHandle = hwndParent;
            ListeningWindow.OnHotKeyDelegate AHotKeyHandler = new ListeningWindow.OnHotKeyDelegate(MyHotKeyHandlerMethod);
            AListeningWindow = new ListeningWindow(AHotKeyHandler);

            RegisterHotKey(AListeningWindow.Handle, 265, ListeningWindow.MOD_SHIFT |
                           ListeningWindow.MOD_ALT, 0x50);

            WaitToUnregisterManualEvent = new System.Threading.ManualResetEvent(false);

            // Create form, return handle, and set handle
            // to WMP so WMP will display it. If you
            // return the parent window handle, no form
            // will pop up.

            return(hwndParent);
        }