A very simple test case:
procedure TForm3.btnCopyClick(Sender: TObject);
begin
HotKey2.HotKey := HotKey1.HotKey;
end;
Press "PgDn" key in the first THotKey and "Page Down" is displayed. Click the ==> button and the second THotKey will display "Num 3".
Similar things happen if modifiers (Shift etc) are pressed. The behaviour also applies to PgUp, Home, End and Ins.
As far as I can see, this happens somewhere inside Windows :( Correct virtual code (34) is sent along the HKM_SETHOTKEY message.
Does somebody know of a nice workaround? Currently, the only idea I got is to send fake WM_KEYDOWN/WM_KEYUP messages with parameters set to VK_NEXT and MapVirtualKey(VK_NEXT) but that is kinda ugly ...
Hotkeys are just simple THotKeys:
object HotKey1: THotKey
Left = 12
Top = 14
Width = 121
Height = 19
InvalidKeys = []
Modifiers = []
TabOrder = 0
end
object HotKey2: THotKey
Left = 194
Top = 14
Width = 121
Height = 19
InvalidKeys = []
Modifiers = []
TabOrder = 1
end
object btnCopy: TButton
Left = 143
Top = 14
Width = 42
Height = 19
Caption = '==>'
TabOrder = 2
OnClick = btnCopyClick
end