keyboard-hook

How to hook Win + Tab using LowLevelKeyboardHook

坚强是说给别人听的谎言 提交于 2019-12-10 02:21:31
问题 In a few words: blocking Win up after Win + Tab makes Windows think Win is still down, so then pressing S with the Win key up for example will open the search charm rather than just type "s"... until the user presses Win again. Not blocking it means the Windows Start menu will show up. I'm in a conundrum! I have no trouble hooking into shortcuts using Alt + Tab using LowLevelKeyboardHook , or Win + Some Ubounded Key using RegisterHotKey . The problem happens only with the Win key using

C# API For Globally Capturing Media Center Remote Special Keys

强颜欢笑 提交于 2019-12-08 12:18:31
问题 I'm writing a media application and I want to have it work with a standard Media Center remote. Arrow keys, Next and Enter work fine (and others I'm sure, but that's what I'm using), but Play and Pause do not work. I'm capturing the other keys with a global hook to the WH_KEYBOARD_LL event. When pressing Play or Pause (not to be confused with Play/Pause on a media keyboard... that works) there are no events, it seems it does not use keyboard events. Is there a standard way in C# to capture

Did MS change something about keyboard hooks in Windows Vista or 7?

你离开我真会死。 提交于 2019-12-08 05:18:42
问题 I've implemented keyboard hooks in several languages (AutoIt, C#) using SetWindowsHookEx and WH_KEYBOARD_LL . I also know of a couple of C++ programs that have the same issue. I didn't post any code because they work perfectly in Windows XP. However, under Windows 7, at some point the hooks become "unloaded" or stop processing any further keys. It seems like it may be related to a low memory condition, but I'm not really sure. Did Microsoft change the way keyboard hooks work in Vista or 7 to

Is there a .NET library for sending keystrokes, mouse clicks, mouse movements and other input? Similar to AutoHotKey but for .NET library use?

假装没事ソ 提交于 2019-12-08 02:27:43
问题 I'm looking to essentially write code similar to what I can do with AutoHotKey, only in .NET and C#, because it's a much more robust environment. I didn't know if there was a wrapper library available for these sorts of hooks or not. Does anyone know of a library that does this for .NET? 回答1: This actually looks pretty promising, I haven't tested it yet, but it's at least a good starting point. Not too bad considering it's on CodeProject. lol. 回答2: For sending keys you can use System.Windows

Capturing a key without focusing the window

风流意气都作罢 提交于 2019-12-07 04:05:32
问题 I have a application that always checks if a key like F12 is pressed. It doesn't need to have in focus of my main window of my app. I tried this code: public int a = 1; // DLL libraries used to manage hotkeys [DllImport("user32.dll")] public static extern bool RegisterHotKey(IntPtr hWnd, int id, int fsModifiers, int vlc); [DllImport("user32.dll")] public static extern bool UnregisterHotKey(IntPtr hWnd, int id); const int MYACTION_HOTKEY_ID = 1; public Form1() { InitializeComponent(); //

Did MS change something about keyboard hooks in Windows Vista or 7?

折月煮酒 提交于 2019-12-06 15:49:48
I've implemented keyboard hooks in several languages (AutoIt, C#) using SetWindowsHookEx and WH_KEYBOARD_LL . I also know of a couple of C++ programs that have the same issue. I didn't post any code because they work perfectly in Windows XP. However, under Windows 7, at some point the hooks become "unloaded" or stop processing any further keys. It seems like it may be related to a low memory condition, but I'm not really sure. Did Microsoft change the way keyboard hooks work in Vista or 7 to add some logic that would unload third-party hooks under certain circumstances? Related questions: how

Is there a .NET library for sending keystrokes, mouse clicks, mouse movements and other input? Similar to AutoHotKey but for .NET library use?

ⅰ亾dé卋堺 提交于 2019-12-06 15:24:54
I'm looking to essentially write code similar to what I can do with AutoHotKey , only in .NET and C#, because it's a much more robust environment. I didn't know if there was a wrapper library available for these sorts of hooks or not. Does anyone know of a library that does this for .NET? This actually looks pretty promising, I haven't tested it yet, but it's at least a good starting point. Not too bad considering it's on CodeProject. lol. For sending keys you can use System.Windows.Forms.SendKeys . For mouse and other input you have to wrap the SendMessage API. 来源: https://stackoverflow.com

SetWindowsHookEx with WH_KEYBOARD doesn't work for me, what do I wrong?

荒凉一梦 提交于 2019-12-06 08:27:16
问题 #include <iostream> #include <fstream> #define _WIN32_WINNT 0x501 #include <windows.h> using namespace std; HHOOK hKeyboardHook = 0; LRESULT CALLBACK KeyboardCallback(int code,WPARAM wParam,LPARAM lParam) { cout << "a key was pressed" << endl; ofstream myfile; myfile.open ("hookcheck.txt", ios::ate | ios::app); myfile << "a key was pressed\n"; myfile.close(); return CallNextHookEx(hKeyboardHook,code,wParam,lParam); } int main() { HWND consoleWindow = GetConsoleWindow(); HINSTANCE hInstCons =

How to determine the current input language?

╄→гoц情女王★ 提交于 2019-12-06 03:59:54
问题 I am designing an on screen keyboard, I need to determine which language been set by the user and which language he is using now in the other threads, i.e. I need to know the language selected in the taskbar language switcher: P.S. current culture returns the language used in the on screen keyboard application, which is not the case I am looking for.. 回答1: The solution was to get the Keyboard Layout for the foreground window, and then apply it to the on screen keyboard, and check for the

Error when using SetWindowsHookEx in Windows XP, but not in Windows 7

♀尐吖头ヾ 提交于 2019-12-06 03:10:52
问题 I have develop a application that use a global keybord/mouse hook. It works perfect in Windows 7, but not in Windows XP. When I call SetWindowsHookEx in Windows XP, I get error code 1428 int MouseLowLevel = 14 int code = SetWindowsHookEx(MouseLowLevel, MouseHookProc, IntPtr.Zero, 0); private IntPtr MouseHookProc(int nCode, IntPtr wParam, IntPtr lParam) {} 回答1: Curious that this code doesn't fail on Win7 but I certainly never tried. But it is correct behavior, looks like they improved it. The