Example #1
0
        public static AppBarStates GetTaskBarState()
        {
            var msgData = new WinAPIFunctions.AppBarData();

            msgData.cbSize = (uint)Marshal.SizeOf(msgData);
            msgData.hWnd   = WinAPIFunctions.FindWindow("System_TrayWnd", null);
            return((AppBarStates)WinAPIFunctions.SHAppBarMessage((uint)AppBarMessages.GetState, ref msgData));
        }
Example #2
0
        private static void SetTaskBarState(AppBarStates option)
        {
            var msgData = new WinAPIFunctions.AppBarData();

            msgData.cbSize = (uint)Marshal.SizeOf(msgData);
            msgData.hWnd   = WinAPIFunctions.FindWindow("System_TrayWnd", null);
            msgData.lParam = (int)option;
            WinAPIFunctions.SHAppBarMessage((uint)AppBarMessages.SetState, ref msgData);
        }
Example #3
0
        public static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam)
        {
            var keyCode = Marshal.ReadInt32(lParam);

            if (nCode < 0 || wParam != (IntPtr)KeyDownEventPointer)
            {
                PressedKeyCodes.Clear();
                return(WinAPIFunctions.CallNextHookEx(_hookId, nCode, wParam, lParam));
            }
            //MessageBox.Show(keyCode.ToString());
            if (onKeyPress != null)
            {
                onKeyPress(keyCode);
            }

            CheckForHotkey(keyCode, wParam);
            return(WinAPIFunctions.CallNextHookEx(_hookId, nCode, wParam, lParam));
        }
Example #4
0
        private static void Main()
        {
            KeyboardHook._hookId = WinAPIFunctions.SetHook(KeyboardHook.KeyboardLowLevelListenerProcess);

            KeyboardHook.onHotkeyPress += KeyPressHandler.HandleHotKeyPress;
            KeyboardHook.onKeyPress    += KeyPressHandler.HandleKeyPress;

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            if (TaskBarHidder.CheckForRunningCopies())
            {
                Application.Run(new TaskBarHidderForm());
            }
            else
            {
                MessageBox.Show("Application is already running", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
            WinAPIFunctions.UnhookWindowsHookEx(KeyboardHook._hookId);
        }