473,761 Members | 2,410 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1439
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.goog legroups.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
1870
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> <td>$val</td>
3
8190
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 is being truncated, we can't do a hot backup (a FULL backup in multiuser mode) because if a transaction comes through during the backup it will leave the backup in an inconsistent state. I'm skeptical, but I don't know how SQL Server 7 avoids...
2
1993
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 is that you can not use regsvr32 to register the COM server so I'm wondering if placing it inside the .NET library will automatically take care of registering it so non managed code programs can access it or do I have to manually use the regasm...
0
2309
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. http://www.rocklyte.com/pandora/manual/modules/screen.html I am trying to capture the system cursor & superimpose it on a screen shot bit map. The problem I am encountering is custom cursors. Custom cursors have hot spots that are often "off". SetCustomCursor() lets you define the...
0
2201
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 strange is after I used Form.ShowInTaskBar = false to hide form, the hot key didn't work any more. I remove the line, then it works again. I try the code in CodeProject SystemHotkey too, but failed. I add Form.ShowInTaskBar = false in its example...
6
1649
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
1666
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 to refere to temporary objects Immidiate referenc: Since literals are assumed as temporary in C++ and immidiate or quick in assembly language.
0
1290
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 in wrong data might be 1000, or -50000 When I draw the bitmap, I would like to neglect these hot pixels (extremely hot, because they are very far away from correct number). And my gray-scale bitmap with start from ->.
2
2217
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. And i found that when i install the setup in Windows XP, it is okey, the abc.ocx can be installed automatically. But when i try to install the program in Vista. It has problem in registering the ocx during installation, even i have clicked Yes...
0
2114
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 callback.setHandler1(callback1) this only seems to affect pythons ability to trigger an "event" in c. PyObject *Handler is always NULL even after I call Register_Handler(...). I thought there was some magic here that was assigning the pointer *Handler to my python...
0
9538
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
10123
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...
1
9909
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
8794
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...
1
7342
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
5241
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
5384
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3889
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
3
3481
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.