private IntPtr captureKey(int nCode, IntPtr wp, IntPtr lp) { if (nCode >= 0 && ScreenshotWindow.IsCurrentlyShowing()) { KBDLLHOOKSTRUCT objKeyInfo = (KBDLLHOOKSTRUCT)Marshal.PtrToStructure(lp, typeof(KBDLLHOOKSTRUCT)); // Disabling Windows keys if (objKeyInfo.key == Keys.RWin || objKeyInfo.key == Keys.LWin || objKeyInfo.key == Keys.Tab && HasAltModifier(objKeyInfo.flags) || objKeyInfo.key == Keys.Escape && (Keyboard.Modifiers & ModifierKeys.Control) != 0) { return((IntPtr)1); // if 0 is returned then All the above keys will be enabled } } return(CallNextHookEx(ptrHook, nCode, wp, lp)); }
protected override void WndProc(ref Message m) { if (m.Msg == Constants.WM_HOTKEY_MSG_ID) { if (t == Type.FullScreen) { Utilities.UploadAllScreens(); } else if (t == Type.Selection) { if (!ScreenshotWindow.IsCurrentlyShowing()) { new ScreenshotWindow().Show(); } } } base.WndProc(ref m); }