473,395 Members | 1,377 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

how to: application wide keyboard hook

hi all,

problem: i have several controls on my form which can get focus, like
buttons/combos. i have to catch keyboard events for special keys like Alt-F1
on my form, for that, i simply implemented keydown event handler on my form
control, but when some other control has focus, all keypress events are
generated on that control.

Q: how can i implement an application wide keypress event handler, so that
if Alt-F1 is press on any control (or on any dialogue of the app), my single
event handler can grab it?

TIA

- sci

Nov 16 '05 #1
1 2911
Try setting Keypreview = true for your form. This should allow its key event
handlers to catch most keys...

===================
Clay Burch, .NET MVP

Visit www.syncfusion.com for the coolest tools

"~dr-sci-fi" <sc******@mailandnews.com> wrote in message
news:uW**************@TK2MSFTNGP10.phx.gbl...
hi all,

problem: i have several controls on my form which can get focus, like
buttons/combos. i have to catch keyboard events for special keys like Alt-F1 on my form, for that, i simply implemented keydown event handler on my form control, but when some other control has focus, all keypress events are
generated on that control.

Q: how can i implement an application wide keypress event handler, so that
if Alt-F1 is press on any control (or on any dialogue of the app), my single event handler can grab it?

TIA

- sci


Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: Frank Rizzo | last post by:
I want to log the user out when there has been a period of inactivity in the application. The key here is inactivity of the application, not the system. I know that you can retrieve the...
2
by: Lance | last post by:
I need to monitor the status of the mouse on an application-wide basis (i.e., not just for the control that owns the mouse). One I idea I had was to create a shared class that inherits from timer...
2
by: Matt | last post by:
Hi all, I have written a small application that runs from the system tray. I need to be able to identify when a user has pressed certain key combinations in any aplication and then respond to...
7
by: jpierson | last post by:
Hi, I am tryin to create a keyboard hook that sends the keystroke ctrl + pause/break. I haven't used keyboard hooks before so I'm not too sure how to use them public int MyKeyboardProc(int...
5
by: neilphan | last post by:
Hi all, I have an application that uses input from a barcode reader via a USB port. My application works fine only if the application HAS FOCUS. If the user opens up another application (not...
3
by: squeak | last post by:
Hi there, I'm new to VB2005 so its probably a very simple answer too! But i just can't think how to do it... Basically i need to detect mouse (and preferably keyboard) movement and kepresses...
1
by: cvairetti | last post by:
Hi, I just write an application in C# that show an interface with five button, each button starts an external application that it comes in front of the main C# application with focus on. When the...
2
by: Justin | last post by:
So I have a keyboard hook that I have implemeted into my c# app. I need to not allow any hotkey actions to be performed when my app is opened. I can capture the key events and handle them if I want...
4
by: =?Utf-8?B?QmVu?= | last post by:
Hi, How can select a single word of text, in any application, e.g. Windows Explorer, Internet Explorer etc. , without double clicking it and instead use a combination of mouse and keyboard, for...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.