473,840 Members | 1,607 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

List of Global Hotkey IDs?

Hi,
Here is 2 questions:
1) I declared some global hotkeys located inside Windows API follows
as:

Private Const MOD_ALT As Integer = 1
Private Const MOD_CONTROL As Integer = 2
Private Const MOD_SHIFT As Integer = 4
Private Const MOD_WIN As Integer = 8

But i need other key's IDs and declarations such as F5, F6 or
Backspace etc. but i couldn't find a all-in-one web resource includes
all.

How can i get all IDs?
2) RegisterGlobalH otkey function is needed to use for these keys and
as sampled here:
RegisterGlobalH otKey(Keys.F6, MOD_CONTROL Or MOD_SHIFT) for pressing
F6+SHIFT+CONTRO L together. "MOD_CONTRO L" and "MOD_SHIFT" are
modifiers.

How can i leave modifiers blank and use RegisterGlobalH otKey function
with only one key like "F6" alone without other key combinations?

Thanks.
Jan 4 '08 #1
9 3775
"kimiraikko nen" <ki************ *@gmail.comschr ieb:
1) I declared some global hotkeys located inside Windows API follows
as:

Private Const MOD_ALT As Integer = 1
Private Const MOD_CONTROL As Integer = 2
Private Const MOD_SHIFT As Integer = 4
Private Const MOD_WIN As Integer = 8

But i need other key's IDs and declarations such as F5, F6 or
Backspace etc. but i couldn't find a all-in-one web resource includes
all.
The 'vk' parameter of 'RegisterHotkey ' accepts any 'VK_*' key constant. You
can find them here:

Virtual-Key Codes
<URL:http://msdn2.microsoft .com/en-us/library/ms927178.aspx>
2) RegisterGlobalH otkey function is needed to use for these keys and
as sampled here:
RegisterGlobalH otKey(Keys.F6, MOD_CONTROL Or MOD_SHIFT) for pressing
F6+SHIFT+CONTRO L together. "MOD_CONTRO L" and "MOD_SHIFT" are
modifiers.

How can i leave modifiers blank and use RegisterGlobalH otKey function
with only one key like "F6" alone without other key combinations?
Simply use 0 as the parameter value.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Jan 4 '08 #2
On Jan 4, 9:18 pm, "Herfried K. Wagner [MVP]" <hirf-spam-me-
h...@gmx.atwrot e:
"kimiraikko nen" <kimiraikkone.. .@gmail.comschr ieb:
1) I declared some global hotkeys located inside Windows API follows
as:
Private Const MOD_ALT As Integer = 1
Private Const MOD_CONTROL As Integer = 2
Private Const MOD_SHIFT As Integer = 4
Private Const MOD_WIN As Integer = 8
But i need other key's IDs and declarations such as F5, F6 or
Backspace etc. but i couldn't find a all-in-one web resource includes
all.

The 'vk' parameter of 'RegisterHotkey ' accepts any 'VK_*' key constant. You
can find them here:

Virtual-Key Codes
<URL:http://msdn2.microsoft .com/en-us/library/ms927178.aspx>
2) RegisterGlobalH otkey function is needed to use for these keys and
as sampled here:
RegisterGlobalH otKey(Keys.F6, MOD_CONTROL Or MOD_SHIFT) for pressing
F6+SHIFT+CONTRO L together. "MOD_CONTRO L" and "MOD_SHIFT" are
modifiers.
How can i leave modifiers blank and use RegisterGlobalH otKey function
with only one key like "F6" alone without other key combinations?

Simply use 0 as the parameter value.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Thanks for second question, but sorry for first. I tried but couldn't
get work.

How will i simulate as the same with the constants i stated in first
post?
(declaration, hexadecimal?)

eg:

Private Const MOD_ALT As Integer = 1
Private Const MOD_CONTROL As Integer = 2
Private Const MOD_SHIFT As Integer = 4
Private Const MOD_WIN As Integer = 8

Those are working, but i want to add outside them more like... TAB,
Escape, F9 etc.

How?

Thanks.
Jan 4 '08 #3
"kimiraikko nen" <ki************ *@gmail.comschr ieb:
1) I declared some global hotkeys located inside Windows API follows
as:
Private Const MOD_ALT As Integer = 1
Private Const MOD_CONTROL As Integer = 2
Private Const MOD_SHIFT As Integer = 4
Private Const MOD_WIN As Integer = 8
But i need other key's IDs and declarations such as F5, F6 or
Backspace etc. but i couldn't find a all-in-one web resource includes
all.

The 'vk' parameter of 'RegisterHotkey ' accepts any 'VK_*' key constant.
You
can find them here:

Virtual-Key Codes
<URL:http://msdn2.microsoft .com/en-us/library/ms927178.aspx>
[...]
How will i simulate as the same with the constants i stated in first
post?
(declaration, hexadecimal?)
Simply take the constant name from the following article:

Virtual-Key Codes
<URL:http://msdn2.microsoft .com/en-us/library/ms927178.aspx>

Then take the value of the according row in the 'Hexadecimal value" column
and compose a constand definition:

'Private Const <Value of symbolic constant columnAs Integer = &H<Value of
Hexadecimal value column>'.

Then you can pass the constant to the 'RegisterHotkey ' function's 'vk'
parameter.

The function declaration should look like that:

\\\
Private Declare Function RegisterHotKey Lib "User32.dll " ( _
ByVal hWnd As IntPtr, _
ByVal id As Int32, _
ByVal fsModifiers As Int32, _
ByVal vk As Int32 _
) As Boolean
///
Private Const MOD_ALT As Integer = 1
Private Const MOD_CONTROL As Integer = 2
Private Const MOD_SHIFT As Integer = 4
Private Const MOD_WIN As Integer = 8
Those are only the modifiers which can be passed to the 'fsModifiers'
parameter.
Those are working, but i want to add outside them more like... TAB,
Escape, F9 etc.

How?
I am not sure which keys can be specified in the 'vk' parameter, but I
suggest to try it with the keys you want to use.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Jan 8 '08 #4
On Jan 8, 11:30 pm, "Herfried K. Wagner [MVP]" <hirf-spam-me-
h...@gmx.atwrot e:
"kimiraikko nen" <kimiraikkone.. .@gmail.comschr ieb:
1) I declared some global hotkeys located inside Windows API follows
as:
Private Const MOD_ALT As Integer = 1
Private Const MOD_CONTROL As Integer = 2
Private Const MOD_SHIFT As Integer = 4
Private Const MOD_WIN As Integer = 8
But i need other key's IDs and declarations such as F5, F6 or
Backspace etc. but i couldn't find a all-in-one web resource includes
all.
The 'vk' parameter of 'RegisterHotkey ' accepts any 'VK_*' key constant.
You
can find them here:
Virtual-Key Codes
<URL:http://msdn2.microsoft .com/en-us/library/ms927178.aspx>
[...]
How will i simulate as the same with the constants i stated in first
post?
(declaration, hexadecimal?)

Simply take the constant name from the following article:

Virtual-Key Codes
<URL:http://msdn2.microsoft .com/en-us/library/ms927178.aspx>

Then take the value of the according row in the 'Hexadecimal value" column
and compose a constand definition:

'Private Const <Value of symbolic constant columnAs Integer = &H<Value of
Hexadecimal value column>'.

Then you can pass the constant to the 'RegisterHotkey ' function's 'vk'
parameter.

The function declaration should look like that:

\\\
Private Declare Function RegisterHotKey Lib "User32.dll " ( _
ByVal hWnd As IntPtr, _
ByVal id As Int32, _
ByVal fsModifiers As Int32, _
ByVal vk As Int32 _
) As Boolean
///
Hi,
Correct declaration must have been this:
'For registration
Private Declare Function RegisterHotKey Lib "user32" (ByVal hwnd As
IntPtr, ByVal id As Integer, _
ByVal fsModifiers As Integer, ByVal vk As Integer) As Integer

'For unregistration
Private Declare Function UnregisterHotKe y Lib "user32" (ByVal hwnd As
IntPtr, ByVal id As Integer) _
As Integer

as stated in:
http://www.dotnet2themax.com/ShowCon...0-c2bb7075ba78
However function declaration is not issue now,
for key combination, i tried declaring VK_SHIFT as follows:
Private Const VK_SHIFT As Integer = &H10

from the msdn link.

Then tried to register F6+SHIFT combination with putting:
RegisterGlobalH otKey(Keys.F6, VK_SHIFT)

but this didn't work.

Only works with modifiers given above or alone with modifier value
zero.
This works:
RegisterGlobalH otKey(Keys.F6, 0)

or this works:
RegisterGlobalH otKey(Keys.F6, MOD_ALT or MOD_CONTROL) with the
declarations given above also.
Thanks.
Jan 8 '08 #5
"kimiraikko nen" <ki************ *@gmail.comschr ieb:
1) I declared some global hotkeys located inside Windows API follows
as:
Private Const MOD_ALT As Integer = 1
Private Const MOD_CONTROL As Integer = 2
Private Const MOD_SHIFT As Integer = 4
Private Const MOD_WIN As Integer = 8
But i need other key's IDs and declarations such as F5, F6 or
Backspace etc. but i couldn't find a all-in-one web resource
includes
all.
>The 'vk' parameter of 'RegisterHotkey ' accepts any 'VK_*' key
constant.
You
can find them here:
>Virtual-Key Codes
<URL:http://msdn2.microsoft .com/en-us/library/ms927178.aspx>
[...]
How will i simulate as the same with the constants i stated in first
post?
(declaration, hexadecimal?)

Simply take the constant name from the following article:

Virtual-Key Codes
<URL:http://msdn2.microsoft .com/en-us/library/ms927178.aspx>

Then take the value of the according row in the 'Hexadecimal value"
column
and compose a constand definition:

'Private Const <Value of symbolic constant columnAs Integer = &H<Value
of
Hexadecimal value column>'.

Then you can pass the constant to the 'RegisterHotkey ' function's 'vk'
parameter.

The function declaration should look like that:

\\\
Private Declare Function RegisterHotKey Lib "User32.dll " ( _
ByVal hWnd As IntPtr, _
ByVal id As Int32, _
ByVal fsModifiers As Int32, _
ByVal vk As Int32 _
) As Boolean
///

Hi,
Correct declaration must have been this:
'For registration
Private Declare Function RegisterHotKey Lib "user32" (ByVal hwnd As
IntPtr, ByVal id As Integer, _
ByVal fsModifiers As Integer, ByVal vk As Integer) As Integer
The return value is a 'Boolean', although 'Integer' will work too.
However function declaration is not issue now,
for key combination, i tried declaring VK_SHIFT as follows:
Private Const VK_SHIFT As Integer = &H10
You cannot use the 'VK_*' constants as modifiers. You can only use the
'MOD_*' constants or the value 0 as modifiers.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Jan 8 '08 #6
On Jan 9, 12:27 am, "Herfried K. Wagner [MVP]" <hirf-spam-me-
h...@gmx.atwrot e:
"kimiraikko nen" <kimiraikkone.. .@gmail.comschr ieb:
1) I declared some global hotkeys located inside Windows API follows
as:
Private Const MOD_ALT As Integer = 1
Private Const MOD_CONTROL As Integer = 2
Private Const MOD_SHIFT As Integer = 4
Private Const MOD_WIN As Integer = 8
But i need other key's IDs and declarations such as F5, F6 or
Backspace etc. but i couldn't find a all-in-one web resource
includes
all.
The 'vk' parameter of 'RegisterHotkey ' accepts any 'VK_*' key
constant.
You
can find them here:
Virtual-Key Codes
<URL:http://msdn2.microsoft .com/en-us/library/ms927178.aspx>
[...]
How will i simulate as the same with the constants i stated in first
post?
(declaration, hexadecimal?)
Simply take the constant name from the following article:
Virtual-Key Codes
<URL:http://msdn2.microsoft .com/en-us/library/ms927178.aspx>
Then take the value of the according row in the 'Hexadecimal value"
column
and compose a constand definition:
'Private Const <Value of symbolic constant columnAs Integer = &H<Value
of
Hexadecimal value column>'.
Then you can pass the constant to the 'RegisterHotkey ' function's 'vk'
parameter.
The function declaration should look like that:
\\\
Private Declare Function RegisterHotKey Lib "User32.dll " ( _
ByVal hWnd As IntPtr, _
ByVal id As Int32, _
ByVal fsModifiers As Int32, _
ByVal vk As Int32 _
) As Boolean
///
Hi,
Correct declaration must have been this:
'For registration
Private Declare Function RegisterHotKey Lib "user32" (ByVal hwnd As
IntPtr, ByVal id As Integer, _
ByVal fsModifiers As Integer, ByVal vk As Integer) As Integer

The return value is a 'Boolean', although 'Integer' will work too.
However function declaration is not issue now,
for key combination, i tried declaring VK_SHIFT as follows:
Private Const VK_SHIFT As Integer = &H10

You cannot use the 'VK_*' constants as modifiers. You can only use the
'MOD_*' constants or the value 0 as modifiers.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
I'm not meaning using modifiers as the aim of this topic. To clarify
better:

I want to use more keys with combinations with F6 such as F6 + TAB or
else which are not declared as modfiers, defined as hotkeys. However
we can sample with modifiers if they'll do the same job;

Also that doesn't work:
'Declaration part
Private Const MOD_TAB As Integer = &H9

'Register hotkey
RegisterGlobalH otKey(Keys.F6, MOD_TAB)

for F6+TAB combination

which doesn't work.

How to do this?

Thanks.
Jan 8 '08 #7
On Jan 9, 12:27 am, "Herfried K. Wagner [MVP]" <hirf-spam-me-
h...@gmx.atwrot e:
"kimiraikko nen" <kimiraikkone.. .@gmail.comschr ieb:
1) I declared some global hotkeys located inside Windows API follows
as:
Private Const MOD_ALT As Integer = 1
Private Const MOD_CONTROL As Integer = 2
Private Const MOD_SHIFT As Integer = 4
Private Const MOD_WIN As Integer = 8
But i need other key's IDs and declarations such as F5, F6 or
Backspace etc. but i couldn't find a all-in-one web resource
includes
all.
The 'vk' parameter of 'RegisterHotkey ' accepts any 'VK_*' key
constant.
You
can find them here:
Virtual-Key Codes
<URL:http://msdn2.microsoft .com/en-us/library/ms927178.aspx>
[...]
How will i simulate as the same with the constants i stated in first
post?
(declaration, hexadecimal?)
Simply take the constant name from the following article:
Virtual-Key Codes
<URL:http://msdn2.microsoft .com/en-us/library/ms927178.aspx>
Then take the value of the according row in the 'Hexadecimal value"
column
and compose a constand definition:
'Private Const <Value of symbolic constant columnAs Integer = &H<Value
of
Hexadecimal value column>'.
Then you can pass the constant to the 'RegisterHotkey ' function's 'vk'
parameter.
The function declaration should look like that:
\\\
Private Declare Function RegisterHotKey Lib "User32.dll " ( _
ByVal hWnd As IntPtr, _
ByVal id As Int32, _
ByVal fsModifiers As Int32, _
ByVal vk As Int32 _
) As Boolean
///
Hi,
Correct declaration must have been this:
'For registration
Private Declare Function RegisterHotKey Lib "user32" (ByVal hwnd As
IntPtr, ByVal id As Integer, _
ByVal fsModifiers As Integer, ByVal vk As Integer) As Integer

The return value is a 'Boolean', although 'Integer' will work too.
However function declaration is not issue now,
for key combination, i tried declaring VK_SHIFT as follows:
Private Const VK_SHIFT As Integer = &H10

You cannot use the 'VK_*' constants as modifiers. You can only use the
'MOD_*' constants or the value 0 as modifiers.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Maybe the keys such as TAB or others except shift, ctrl, alt is not
available for some instances such as capturing screen or others? There
are some programs only uses shift, alt or ctrl + a "F" key or letter
key for combination.
Jan 8 '08 #8
"kimiraikko nen" <ki************ *@gmail.comschr ieb
I'm not meaning using modifiers as the aim of this topic. To clarify
better:

I want to use more keys with combinations with F6 such as F6 + TAB
or else which are not declared as modfiers, defined as hotkeys.
However we can sample with modifiers if they'll do the same job;

Also that doesn't work:
'Declaration part
Private Const MOD_TAB As Integer = &H9

'Register hotkey
RegisterGlobalH otKey(Keys.F6, MOD_TAB)

for F6+TAB combination

which doesn't work.

How to do this?

You can not do this. You can specify exactly /one/ virtual key (Tab, F6,
....) AND optionally modifiers like Shift or Control. Pressing F6+Tab is
not supported, only Shift+Tab, Shift+F6, Ctrl+Tab, Ctrl+F6, and so on.
Armin

Jan 9 '08 #9
On Jan 9, 2:38 am, "Armin Zingler" <az.nos...@free net.dewrote:
"kimiraikko nen" <kimiraikkone.. .@gmail.comschr ieb
I'm not meaning using modifiers as the aim of this topic. To clarify
better:
I want to use more keys with combinations with F6 such as F6 + TAB
or else which are not declared as modfiers, defined as hotkeys.
However we can sample with modifiers if they'll do the same job;
Also that doesn't work:
'Declaration part
Private Const MOD_TAB As Integer = &H9
'Register hotkey
RegisterGlobalH otKey(Keys.F6, MOD_TAB)
for F6+TAB combination
which doesn't work.
How to do this?

You can not do this. You can specify exactly /one/ virtual key (Tab, F6,
...) AND optionally modifiers like Shift or Control. Pressing F6+Tab is
not supported, only Shift+Tab, Shift+F6, Ctrl+Tab, Ctrl+F6, and so on.

Armin
Thanks for the tip:
I have found some info for modifier keys on Wiki:
http://en.wikipedia.org/wiki/Modifier_key
Jan 9 '08 #10

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

Similar topics

1
1914
by: Nitesh Jain | last post by:
I want to write a simple utility, so that if I select a text, and press a hot key say (CTRL+ALT+G), then I should be able to open a google search page with the selected text. Could someone tell me how to get the selected text when this hotkey is pressed.
0
1449
by: kurotsuke | last post by:
Can anybody tell me where I can find a sample C# forms that implements the hotkey selection like in babylon so that the user can actually press the hotkey combination instead of selecting the keys on a listbox? Thanks.
3
2613
by: Rsrany | last post by:
I've been working on a few gtk applications and need to tie a hot key catcher into a thread. I am currently finding threaded user32.GetMessageA do not work. I have included two programs: 1) a non-threaded version that works 2) a threaded version that doesnt work. Any constructive suggestions would be helpful
2
8322
by: Marc Gravell | last post by:
Just a thought prompted by the chain "Splitting up a string"; ages ago a wrote (in VB via Windows API dll calls) a global hotkey app that runs silently, intercepts ++V, converts the clipboard to a string and sends +; I still use it almost constantly, but it is a pain to maintain. I couldn't find any native C# support for global hotkey (CLR2.0) - any idea if this could be re-written in C# without any dll imports in my code? Marc
1
5963
by: Rune Jacobsen | last post by:
Hi all, I have some often-performed tasks in my applications that I want users to be able to specify hotkeys for. However, I don't want to hard code these hotkeys, as sooner or later some other app is bound to use the same thing, causing end user frustration. So I want the end user to be able to specify the hot key to use for task X in the configuration window. Now receiving and handling the hotkey is no problem. I do that easily...
9
18907
by: k04jg02 | last post by:
I want to make a Python app that runs in the background, and when a user hits a key combination, for a function to run. This sounds simple enough, but all of the keypress detecting libraries I can find count on you creating a window and then detecting keypresses while that window has focus. I want my function to execute when the user presses the hotkey anywhere. I searched the PyGTK documentation and found an old newsgroup post where...
0
1429
by: jayquest | last post by:
Any ideas? I want to create a global windows hotkey that performs an action on the selected text in any windows program (that is not read only of coarse). For example: Remove all spaces from this text string, or carriage return after every period etc. Any help would be greatly appreciated. Thanks jayquest
3
8224
by: Appr3nt1c3 | last post by:
Hello everyone! I am new to VB .Net and currently i'm using vb .net 2005. My question is: Is there a way to assign a global key handler for a certain key, like if i press F9 or any other key from any part of my program, a function or sub would be invoked? I used to do programming in Clipper and this done achieved by the Setkey( <nKey>, <bFunction) function. Can this be done in VB .Net?
18
44797
by: AdamOnAccess | last post by:
Anyone know an easy way to toggle between Form and Design view with a hotkey? I know you can switch from Design view to Form view with hotkey F5. But is there a hotkey to switch back (from Form view to Design)? Shift-F5 is not it. I've searched Google and I can't believe I couldn't find an answer. Please help. Adam
0
9860
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
9699
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10603
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
10660
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
9440
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
5685
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
5874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4076
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3138
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.