473,320 Members | 2,180 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,320 software developers and data experts.

Registering hot-keys for your Winform

I want to register a hotkey for my WinForm so that when I hold the,
say, Alt+M keys, it minimizes. How do I do that?

Jun 27 '06 #1
4 1414
I found the easiest way is to create a menu item to do this and then link
the "hot key" to the menu item.

HTH
Simon

--
================================
Simon Verona
Dealer Management Service Ltd
Stewart House
Centurion Business Park
Julian Way
Sheffield
S9 1GD

Tel: 0870 080 2300
Fax: 0870 735 0011

"Water Cooler v2" <wt*****@yahoo.com> wrote in message
news:11**********************@75g2000cwc.googlegro ups.com...
I want to register a hotkey for my WinForm so that when I hold the,
say, Alt+M keys, it minimizes. How do I do that?

Jun 27 '06 #2
"Simon Verona" <no****@nomail.zzz> schrieb:
I found the easiest way is to create a menu item to do this and then link
the "hot key" to the menu item.


ACK. Note that the menu item doesn't necessarily need to be visible.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Jun 27 '06 #3
Thanks! That is a nice tip I will surely use in the future. For now,
I'll be using the Win32 API to register the hotkey that is system-wide
because this menu-item solution, I believe:

1. Will not be system-wide; and
2. Will not be able to restore the form once minimized.

But a great tip I never thought of, really. Thanks a lot.

Another related question:

I've seen examples that use RegisterHotKey API without a global atom
and some that do add a global atom for the key in the Global Atom
database. Would someone tell me whether it is absolutely necessary to
have a global atom for the hotkey? If not, what is the difference
between the two approaches.

Jun 27 '06 #4
Look at Francesco`s article regrding this

http://www.dotnet2themax.com/ShowCon...0-c2bb7075ba78
the attom thingy well he tells it here :

"you need to install the hotkey, which you do by calling the RegisterHotKey
API function: this function takes a unique id, and MSDN docs explain that you
should call GlobalAddAtom to get such an id. Besides, you must store this id
in a form variable, because you need it later, to unregister the class and
delete the global atom you created"

so someone using the RegisterHotKey API function without the use of a
doesn`t follow the MSDN rule for getting the unique id or doesn`t care about
a good cleanup routine ( or isn`t aware that he should call GlobalAddAtom to
get such an id )
regards

Michel Posseth [MCP]

"Water Cooler v2" wrote:
Thanks! That is a nice tip I will surely use in the future. For now,
I'll be using the Win32 API to register the hotkey that is system-wide
because this menu-item solution, I believe:

1. Will not be system-wide; and
2. Will not be able to restore the form once minimized.

But a great tip I never thought of, really. Thanks a lot.

Another related question:

I've seen examples that use RegisterHotKey API without a global atom
and some that do add a global atom for the key in the Global Atom
database. Would someone tell me whether it is absolutely necessary to
have a global atom for the hotkey? If not, what is the difference
between the two approaches.

Jun 28 '06 #5

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

Similar topics

4
by: Bob | last post by:
Hi, I am having trouble registering a row from a mysql query so far I have the mysql part working : while ( $val = mysql_fetch_array( $result )) { print("<tr><td>$val</td> <td>$val</td>...
3
by: JB | last post by:
We have a SQL Server 7.0 database running with trunc. log on chkpt and select into/bulkcopy checked and need to develop a backup strategy. One of our DBAs insists that since the transaction log...
2
by: glenn | last post by:
I have written a COM Server in C# and its working perfectly. I am not ready to deploy to client computers to begin the real testing and am now wondering how to perform. The part that confuses me...
0
by: gregory_may | last post by:
I apologize for cross posting, but I don't know the best place to post this. This link is a pretty good overview of the various System Cursor routines....
0
by: yasker | last post by:
Hi, all I'm developing an application that needs to pop up when the user presses a global hot key. I followed instruction using Win32 API RegisterHotKey. It works fine at first, but what's the...
6
by: mohit.akl | last post by:
hey guys I got trouble implementing hot toolbar like intertnet explorer in my win forms. Could someone please give me ideas... thanks
0
by: terminator | last post by:
first: I find the 'r/l-value reference' terminology rather confusing and I find the following names for this new refrence type more suitable: temporary reference: Since it is generally intended...
0
by: ProtossLee | last post by:
Hi, I am make a project to draw bitmap image. Pixel intensities are calculated from data received from instruments. Problem is, sometimes I get wrong data points, such as: correct data should be...
2
by: linuxfedora | last post by:
I have written a C# program which has an activeX control (abc.ocx) in Visual Studio 2005, and used the setup and deployment project to create an setup.exe and setup.msi that act as an installer. ...
0
by: Tim Spens | last post by:
--- On Fri, 6/27/08, Tim Spens <t_spens@yahoo.comwrote: I think I know where the problem is but I'm unsure how to fix it. When I call Register_Handler(...) from python via...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.