keyboard-hook

C# - Why won't a fullscreen winform app ALWAYS cover the taskbar?

I'm using Windows Vista and C#.net 3.5, but I had my friend run the program on XP and has the same problem. So I have a C# program that I have running in the background with an icon in the SystemTray. I have a low level keyboard hook so when I press two keys (Ctr+windows in this case) it'll pull of the application's main form. The for...

C# Mono - Low Level Keyboard Hook

I'm using code that I found on the CodeProject.com for a low-level keyboard hook. The only problem is it uses external DLL calls that don't work in mono. I was wondering if anyone knew of a way to accomplish the same thing as that code, but will run in both Windows using .net, and Linux using mono? Edit: Clarifying what I'm trying to...

ShowDialog() from keyboard hook event in c#

I want to call ShowDialog() when a keyboard hook event is triggered but I'm having some difficulties: ShowDialog() blocks so I can't call it from the hook triggered event because it will block the OS. I can start a new thread and call ShowDialog() from there, but I get some nasty exception. I guess I can't call ShowDialog() in any othe...

How do I create a keyboard hook with a different thread in C#?

I'm creating a low level keyboard hook in c# using SetWindowsHookEx, question is how can I make the on keyboard event function run on a thread other from the main thread? Also I currently don't have a thread other then the main thread, so how can I create one that will halt until a keyboard hook event will occur? ...

Keyboard Hook... not getting Lower or Upper case characters

The function below is logging the "0", "z" and the "1" ok... but its not capturing the "Z" (shift-z)... any help would be appreciated... __declspec(dllexport) LRESULT CALLBACK HookProc (UINT nCode, WPARAM wParam, LPARAM lParam) { if ((nCode == HC_ACTION) && (wParam == WM_KEYUP)) { // This Struct gets infos on typed key ...

Adobe AIR Keyboard Hook

I'm trying to add a feature to my AIR app that can listen for (configurable) global keyboard events even when the app is minimized. Ex: CTRL-ALT-SHIFT-F12 to grab a screenshot. I can't find any way to register a keyboard hook, and listening for keyboard events only captures them when the app has focus. Suggestions? ...

How can I simulate key presses to any currently focused window?

I am trying to change the keys my keyboard sends to applications. I've already created a global hook and can prevent the keys I want, but I want to now send a new key in place. Here's my hook proc: LRESULT __declspec (dllexport) HookProc(int nCode, WPARAM wParam, LPARAM lParam) { int ret; if(nCode < 0) { return CallNex...

Intercepting the Fn key on laptops

Sometimes when I work on Thinkpads/MSI laptops, the Ctrl and Fn key are swapped (Fn being the leftmost key), and it drives me nuts - I keep hitting Fn instead of Ctrl. I was wondering if it's at all possible to intercept the Fn key. I'd like to write a hook that swaps the Ctrl/Fn keys, but it seems that Fn is not being processed by the ...

Global keyboard capture in C# application

I want to capture a keyboard shortcut in my application and trigger a dialog to appear if the user presses a keyboard combo even outside of the app. Similar to Google Desktop Search's Ctrl, Ctrl to bring up the search dialog. I have tried using some keyboard hook modules out there that basically use Win32 interop to get this effect but ...

How to hook external process with SetWindowsHookEx and WH_KEYBOARD

I am trying to hook for example Notepad without sucess. Making a global hook seems to work fine. Testing on XP SP2. Edit: Amended code works now. MyDLL code #include <windows.h> #include <iostream> #include <stdio.h> HINSTANCE hinst; #pragma data_seg(".shared") HHOOK hhk; #pragma data_seg() //#pragma comment(linker, "/SECTION:.share...

Disabling keys using windows hooks

I am trying to completely disable the letter 'a' on the keyboard using lowlevel keyboard hook. The problem is that when i return 0 from keyboardproc the key is not disabled but when i return 1 it gets disabled. I thought that returning from keyboardproc without calling CallNextHookEx blocks the message. Is there any difference between re...

How can my app find the sender of a windows message?

I have an app which uses a keyboard hook procedure in a library. The wParam in the hook for one message is 255 which we think is "(reserved / OEMClear)". I'd like to work out the source of this message as it causes my application to crash in the library, and given it shouldn't be happening it would be good to identify it. The message com...

Blocking shortcut keys using c#

I am using the below code to disable the Alt+Tab, Alt+Esc, Ctrl+Esc, and Windows Key but somehow it is not working. Please help me rectify it. namespace BlockShortcuts { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private delegate int LowLevelKeyboard...

How do I trap windows key, alt+tab, ctrl+alt+delete in C#?

How do I trap Windows key, Alt+Tab, and Ctrl+Alt+Delete in a Windows application using C#? ...

Applying a modifier key from one keyboard to a keypress on another in OS X

I want to use a foot pedal to press the key, but OS X won't associate a modifier keys across two different devices. I've found some applications that create virtual keyboards, such as synergy+, so I know it must be possible to capture events from 2 devices and merge them as if they were coming from one device. Any ideas on how I can mak...

Binding key combinations to your application

How can I bind a key combination to my vb.net application? I know it has SOMETHING to do with the registry, but I have no earthly idea what or how to go about doing this. I want the user to be able to hit those keys when the app is open and have it execute my function, but not while the app is closed. Thanks for the help! ...

System wide keyboard hook on Vista and later

I have a system-wide keyboard hook DLL that I have created that has been working successfully for years in Windows XP. However, it appears that in certain later versions of Windows (Vista Home Premium, and Windows 7, to name a couple), the hook either does not work at all, or it simply works only locally within the application that inst...

GetAsyncKeyState Vs Low Level WIndows Hook

What should be used to log keys. GetAsyncKeyState or low level windows hook. I found that GetAsyncKeyState sometimes loses key strokes and the messages sent sometimes appear out of order. Low level hooks seem to be the only way to do this. Please suggest. Thanks ...

ToAscii/ToUnicode in a keyboard hook destroys dead keys.

It seems that if you call ToAscii() or ToUnicode() while in a global WH_KEYBOARD_LL hook, and a dead-key is pressed, it will be 'destroyed'. For example, say you've configured your input language in Windows as Spanish, and you want to type an accented letter á in a program. Normally, you'd press the single-quote key (the dead key), then...

Modifying keyboard-hook code to fit my own purposes... where to begin?

I'm writing a program that sits in the systray. It will have a keyboard hook into all typed input, in any open application. I want it to intercept any typed input, run code on that input, and then send the new 'correct' character to be typed. This new character will be what shows up in the app that has focus. I found this code via anoth...