예제 #1
0
 private IntPtr HookCallback(
     int nCode, IntPtr wParam, IntPtr lParam)
 {
     if (nCode >= 0 && wParam == (IntPtr)WM_KEYDOWN)
     {
         int vkCode = Marshal.ReadInt32(lParam);
         KeyboardHookEventArgs keyHookArgs = new KeyboardHookEventArgs(vkCode);
         KeyIntercepted(keyHookArgs);
     }
     return(CallNextHookEx(_hookID, nCode, wParam, lParam));
 }
예제 #2
0
파일: main.cs 프로젝트: vantruc/skimpt
        private void KeyboardHookInstance_KeyIntercepted(KeyboardHookEventArgs keyboardEvents)
        {
            skImage myImage = null;
            Bitmap i;

            if (keyboardEvents.PressedKey == Keys.PrintScreen) {
                switch (CurrentMode) {
                    case mode.FullScreen:
                        i = skImageCapture.GetDesktopWindowCaptureAsBitmap();
                        myImage = new skImage(i);
                        break;
                    case mode.CameraMode:
                        this.Hide();
                        if (!instanceCreated) {
                            mc = new WindowLayer();
                            instanceCreated = true;
                            mc.Show();
                        } else {
                            WindowFrameToCapture = mc.GetWindowFrame();
                            i = skImageCapture.CaptureDeskTopRectangle(WindowFrameToCapture, WindowFrameToCapture.Width, WindowFrameToCapture.Height);
                            myImage = new skImage(i);
                            mc.Dispose();
                            mc = null;
                            instanceCreated = false;
                        }
                        break;
                    case mode.HighlightMode:
                        this.Hide();
                        if (!instanceCreated) {
                            mc = new WindowLayer();
                            instanceCreated = true;
                            mc.Show();
                        } else {
                            WindowFrameToCapture = mc.GetWindowFrame();
                            i = skImageCapture.GetDesktopWindowCaptureAsBitmap();
                            myImage = new skImage(i, WindowFrameToCapture);
                            mc.Dispose();
                            mc = null;
                            instanceCreated = false;
                        }
                        break;
                    default:
                        MessageBox.Show("unable to capture screen");
                        break;
                }

                if (myImage != null) {
                    Common.ShowToastForm(myImage);
                }

            }
        }
예제 #3
0
파일: test.cs 프로젝트: vantruc/skimpt
             void KeyboardHookInstance_KeyIntercepted(KeyboardHookEventArgs keyboardEvents) {

                 Console.WriteLine(keyboardEvents.PressedKey);
               
             }               
예제 #4
0
 private IntPtr HookCallback(
     int nCode, IntPtr wParam, IntPtr lParam)
 {
     if (nCode >= 0 && wParam == (IntPtr)WM_KEYDOWN) {
         int vkCode = Marshal.ReadInt32(lParam);
         KeyboardHookEventArgs keyHookArgs = new KeyboardHookEventArgs(vkCode);
         KeyIntercepted(keyHookArgs);
     }
     return CallNextHookEx(_hookID, nCode, wParam, lParam);
 }