473,769 Members | 2,116 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2939
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******@maila ndnews.com> wrote in message
news:uW******** ******@TK2MSFTN GP10.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
46685
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 inactivity of the system via GetLastInputInfo. That's not what I want - I want inactivity of the application. Thanks.
2
1848
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 and tests Windows.Forms.Control.MouseButtons and Windows.Forms.Cursor.Current.Position in the tick event. Obviously this technique is not perfect because I am relying on the tick event. Also, I've discovered that Windows.Forms.Control.MouseButtons...
2
1219
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 them in my app. I have looked into system wide hooking but it seems very complicated and I have read that this can only be done using a C# dll. Can anyone help with this or at least point me in the right direction ? Thanks,
7
26541
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 nCode, int wParam, int lParam) {
5
5430
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 mines) such as notepad/word, etc, the Barcode Reader reads data into the applicaton that currently has focus with is notepad/word but not my own applicaton. My question is as follows: Is there a way to write a Listener
3
4965
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 when my application is just minimized and not the active forground app. I only need to triger an event which is going to tell my app if the
1
3000
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 users finish to use the external program and close it, under there is still the c# application that let the user choose other software to start. Now the problem is that sometimes I lost the focus of the external application and so it becomes...
2
5975
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 to. The only problem is that I have fields that require input. Do I have to programmatically add the characters to the input fields when I am handling the event. I don't want these keys sent to the system. But only to my program. Or does...
4
2263
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 example Left Control key + Right Mouse Button, and retrieve that word into my application. The app Babylon does somthing similar to this, so I guess it's possible to do it in c# too. Any ideas?
0
9579
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10038
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9857
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7404
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5294
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3952
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3558
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2812
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.