473,779 Members | 2,063 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Trapping keypresses outside of application

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,
Matt.

Nov 21 '05 #1
2 1219
Hi,
You might want to look at this one:
http://www.codeproject.com/csharp/GlobalSystemHook.asp

"Matt" <Ma**@discussio ns.microsoft.co m> wrote in message
news:2E******** *************** ***********@mic rosoft.com...
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,
Matt.


Nov 21 '05 #2
* "=?Utf-8?B?TWF0dA==?=" <Ma**@discussio ns.microsoft.co m> scripsit:
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.


You'll need a keyboard hook to capture these keystrokes system-wide:

Article on keyboard hooks:

<URL:http://www.developer.c om/net/net/article.php/11087_2193301_1/>

Documentation on hooks:

<URL:http://msdn.microsoft. com/library/en-us/dnwui/html/msdn_hooks32.as p>
<URL:http://msdn.microsoft. com/library/en-us/winui/winui/windowsuserinte rface/windowing/hooks.asp>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #3

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

Similar topics

4
2955
by: Wugi | last post by:
I'm trying to find an equivalent of key-event trapping which is easy in QBasic. Several of my programs build up a geometric figure with two parameter line families, eg with two nested for..next loops; after that, the process is redone, or moves on to a new position of the same figure. With a slow system each build-up may take some time. But after, say the inner for...next loop it's easy to scan for a key-event with an a$=inkey$ command...
3
6901
by: Nathan Bloomfield | last post by:
Hi there, I am having difficulty with a piece of code which would work wonders for my application if only the error trapping worked properly. Basically, it works as follows: - adds records from rsSource into rsDest - if it finds a key violation then it deletes the current record from rsDest and adds the new record from rsSource. This works perfectly - but only for the first found duplicate record, it brings up the error
3
2747
by: windandwaves | last post by:
Hi Gurus Does anyone know how I set the error trapping to option 2 in visual basic. I know that you can go to tools, options and then choose on unhandled errors only, but is there a VB command that I can use instead? Cheers Nicolaas
13
4485
by: Thelma Lubkin | last post by:
I use code extensively; I probably overuse it. But I've been using error trapping very sparingly, and now I've been trapped by that. A form that works for me on the system I'm using, apparently runs into problems on the system where it will actually be used, and since I used so little error-trapping it dies very ungracefully. I will of course try to fix whatever is causing the error and add error-trapping to the functions where the...
1
2256
by: Chirag Malvi | last post by:
hello all, I am developing the web application using ASP.net and VS.2003 IDE. here is the situation which i want to implement. 1) User is browsing some webform. I want to trap this event. this i am doing with Session_Onstart. 2) Now when user is exiting i.e. closing the browser window i want to trap this event and perform some operation. I tried using Session_OnEnd event,but
2
3880
by: Captain Nemo | last post by:
I'm still using Office 2000 myself, but some of my clients have Office 2003. I've recently added a piece of code to create an instance of Word, open a document, fill in the blanks and become visible so the document can be printed and/or modified. This all takes place within one form, in which the Word.Application and Word.Document objects are both private form-level variables. Just to be on the safe side I included this piece of code in...
9
2110
by: 47computers | last post by:
Pretty new to PHP, I recently started learning about error trapping. As of right now, I include the following into a page in my website: -------BEGIN PASTE-------- error_reporting(E_ERROR | E_PARSE); set_error_handler("SendErrorReport"); function SendErrorReport($errorNumber, $errorMessage, $errorFile, $errorLine, $vars) {
1
3043
by: jan.loucka | last post by:
I'm developing WinForms application in .NET 2.0 that talks to web service. The automatically generated proxy (reference class) has got methods for both synchronous and asynchronous invocations of the web service methods. What I like about the asynchronous calls that they use events. So when I call the web service operation is finished is fires the event. So all my objects that I'm using in my client application just subscribe to whatever...
0
1036
by: SQACPP | last post by:
I try to figure out the proper way to trap MouseMove events outside my application. Is the better way is to use Win32 api to trap a WM_MOUSEMOVE by hooking all the other application??? There is no other way to do this in C++/CLI ?? I saw some VC 6.0 examples but it's different wen using VC8.0 2005 There is a TextBox in my application and I want to display the text reterned (WM_GETTEXT) by an external window pointed by the mouse. ...
0
10306
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10138
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...
1
10074
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9930
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...
0
8961
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6724
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5503
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3632
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2869
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.