Example #1
0
        private void Subprocess_Shown(object sender, EventArgs e)
        {
            LoadProperties();
            this.Hide();
            this.ShowInTaskbar = false;
            pipeClient         = new PipeClient(RecieverPipeName);

            rawInput = new RawInput();
            rawInput.RawKeyPressEvent += new RawInput.RawInputHandler(RawInputHandler);
            rawInput.Start();

            NEHHook.StartHook(Handle);

            if (!NEHHook.StartHook(Handle))
            {
                MessageBox.Show("Something went wrong while starting the Hook.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #2
0
        private async Task HandleKeyPressAsync(KeyPressState state, int vKey)
        {
            if (isAdminProcess)
            {
                if (!ProcessHelper.IsForegroundProcessAdmin())
                {
                    return;
                }
            }

            bool success = await pipeClient.Send($"{(int)state} {vKey}");

            if (!success)
            {
                NEHHook.StopHook();
                Environment.Exit(1);
            }
            await Task.Delay(0);
        }