Beispiel #1
0
        public Control(string dirpath, bool start_in_boot)
        {
            InitializeComponent();

            Hook          = new KeyHook();
            Hook.KeyDown += Hook_KeyDown;
            Hook.KeyUp   += Hook_KeyUp;

            KD = new KeyDetector();
            KD.KeyDownAndUpEvent += KD_KeyDownAndUpEvent;

            viewer  = new Viewer();
            rviewer = new RichView();

            if (dirpath != null && Directory.Exists(dirpath))
            {
                LogPath = Path.Combine(dirpath, $"{DateTime.Now.ToString("yyyyMMddHHmmss")}-{Process.GetCurrentProcess().Id}-Log.log");

                WriteLogToFile = true;
            }

            if (start_in_boot)
            {
                btn_enable_Click(null, null);
            }
        }
Beispiel #2
0
        private void Hook_KeyDown(object sender, KeyDownEventArgs e)
        {
            KD.KeyDown(e.Key);

            var session = KeyDetector.GetKeySession();

            string Logstr = $"{DateTime.Now.ToLongTimeString()}: {session.ProcessName}[{session.WindowName}]: {e.Key}";

            viewer.lbox_log.Items.Insert(0, Logstr);
        }