Esempio n. 1
0
 protected virtual void OnKeyHookEvent(KeyHookEventArgs e)
 {
     if (KeyHookEvent != null)
     {
         this.KeyHookEvent(this, e);
     }
 }
Esempio n. 2
0
 //如果要捕获鼠标 对PrtScr键进行拦截
 private void m_keyHook_KeyHookEvent(object sender, KeyHookEventArgs e)
 {
     if (e.KeyCode == (int)Keys.PrintScreen && checkBox_CaptureCursor.Checked)
     {
         if (DateTime.Now.Subtract(m_dtLastDownPrt).TotalMilliseconds > 500)
         {
             FrmCapture.DrawCurToScreen();       //如果按下不松开会一直触发
         }
         m_dtLastDownPrt = DateTime.Now;
         //下面是尝试了些在桌面绘制了鼠标之后然后将画上去的鼠标刷掉 结果貌似失败了  算了
         //Console.WriteLine(rect.ToString());
         //Win32.LPRECT lpRect = new Win32.LPRECT() {
         //    Left = rect.Left, Top = rect.Top,
         //    Right = rect.Right, Bottom = rect.Bottom
         //};
         //IntPtr desk = Win32.GetDesktopWindow();
         //IntPtr deskDC = Win32.GetDCEx(desk, IntPtr.Zero, 0x403);
         //Graphics g = Graphics.FromHdc(deskDC);
         //g.FillRectangle(new SolidBrush(Color.FromArgb(128, Color.Red)), new Rectangle(100, 100, 400, 400));
         //Console.WriteLine(Win32.RedrawWindow(IntPtr.Zero, ref lpRect, IntPtr.Zero, 0x85));
         //Console.WriteLine((Win32.RDW_INTERNALPAINT | Win32.RDW_INVALIDATE | Win32.RDW_NOERASE).ToString("X"));
         //Console.WriteLine(Win32.InvalidateRect(Win32.GetDesktopWindow(), ref lpRect, false));
         //Console.WriteLine(lpRect.Left + " " + lpRect.Top + " " + lpRect.Right + " " + lpRect.Bottom);
     }
 }