Home All Groups Group Topic Archive Search About

Some hotkeys register but....

Author
12 May 2005 4:21 AM
Jack
Hello,
          How to explain that:
Using CTRL key combination with another key sometimes such combination
registers without an error but it does not work.
For example:
CTRL + all function keys.
It registers with Windows but it does not work.
Jack

Author
12 May 2005 7:25 AM
Tom Esh
On Thu, 12 May 2005 00:21:56 -0400, "Jack" <replyto@newsgroup> wrote:

>          How to explain that:
>Using CTRL key combination with another key sometimes such combination
>registers without an error but it does not work.
>For example:
>CTRL + all function keys.
>It registers with Windows but it does not work.
>Jack

AFIK there's nothing special about Ctrl+Fcn keys. They work fine here
with the RegisterHotKey Api function and subclassing for WM_HOTKEY, or
with the WM_SETHOTKEY method. Maybe post the code you're using to set
it.


-Tom
MVP - Visual Basic
(please post replies to the newsgroup)
Author
13 May 2005 3:07 AM
Jack
It does not work on 2 different computers.
The following key combination does not work:
CTRL + Function Keys F1 -F12
Code:
Declare Function RegisterHotKey Lib "user32.dll" (ByVal hwnd As Long, ByVal
Id As Long, ByVal fsModifiers As Long, ByVal vk As Long) As Long

rtn = RegisterHotKey(Me.hwnd, Id, MOD_CONTROL, Vkey)

for VKey I use Vkey = vbKeyF1  --->   to vbKeyF12

API returns rtn > 0 so registration is successful.
However WM_HOTKEY message is never fired.

Just to make sure:
Only CTRL+ Function key combination does not work.
Using the same code with another CTRL + key combination works fine.

Your thoughts please.
Jack

Show quote
"Tom Esh" <tjeshGibber***@suscom.net> wrote in message
news:gcv581t2pij4j2sqmfagam6dfghoeeifd9@4ax.com...
> On Thu, 12 May 2005 00:21:56 -0400, "Jack" <replyto@newsgroup> wrote:
>
>>          How to explain that:
>>Using CTRL key combination with another key sometimes such combination
>>registers without an error but it does not work.
>>For example:
>>CTRL + all function keys.
>>It registers with Windows but it does not work.
>>Jack
>
> AFIK there's nothing special about Ctrl+Fcn keys. They work fine here
> with the RegisterHotKey Api function and subclassing for WM_HOTKEY, or
> with the WM_SETHOTKEY method. Maybe post the code you're using to set
> it.
>
>
> -Tom
> MVP - Visual Basic
> (please post replies to the newsgroup)
Author
13 May 2005 7:30 AM
Tom Esh
Show quote
On Thu, 12 May 2005 23:07:41 -0400, "Jack" <replyto@newsgroup> wrote:

>It does not work on 2 different computers.
>The following key combination does not work:
>CTRL + Function Keys F1 -F12
>Code:
>Declare Function RegisterHotKey Lib "user32.dll" (ByVal hwnd As Long, ByVal
>Id As Long, ByVal fsModifiers As Long, ByVal vk As Long) As Long
>
>rtn = RegisterHotKey(Me.hwnd, Id, MOD_CONTROL, Vkey)
>
>for VKey I use Vkey = vbKeyF1  --->   to vbKeyF12
>
>API returns rtn > 0 so registration is successful.
>However WM_HOTKEY message is never fired.
>
>Just to make sure:
>Only CTRL+ Function key combination does not work.
>Using the same code with another CTRL + key combination works fine.
>
>Your thoughts please.

Hmmm... strange. Only a couple things come to mind:

1) The Id value. It should be between 0 and &HBFFF, and if your app is
registering multiple hotkeys it should be different for each.

2) Test the compiled exe with nothing else running, especially VS or
the IDE. They like to hijack F keys.

3) Presumably your MOD_CONTROL declare is correct since it works with
other Ctrl+ combinations, but just in case:
    Const MOD_CONTROL = &H2


-Tom
MVP - Visual Basic
(please post replies to the newsgroup)

AddThis Social Bookmark Button