
About IShellLink::SetHotkey
Quote:
> Hi,all:
> I call SetHotkey(HOTKEYF_ALT | HOTKEYF_CONTROL | VK_P);It produces error
> C2065: 'VK_P' : undeclared identifier.Could you offer a sample for passing
> on the parameter(WORD wHotKey)?
Yup, VK_P isn't #defined by the windows headers. The file 'WinUser.h' contains the following...
/*
* VK_0 - VK_9 are the same as ASCII '0' - '9' (0x30 - 0x39)
* 0x40 : unassigned
* VK_A - VK_Z are the same as ASCII 'A' - 'Z' (0x41 - 0x5A)
*/
...so you need to just use 'P' instead. I think too that you'll need to manually shift your modifier
flags into the HIBYTE as they are #defined in the LOBYTE range (1, 2, 4). So something like this...
#define MAKEHOTKEY(mod, key) ((WORD)((WORD)(BYTE)mod << 8) | (BYTE)key)
pisl->SetHotkey(MAKEHOTKEY((HOTKEYF_ALT | HOTKEYF_CONTROL), 'P'))
...or maybe this...
union {
WORD flags;
struct {
WORD key:8;
WORD mod:8;
};
} hotKey;
hotKey.mod = (HOTKEYF_ALT | HOTKEYF_CONTROL);
hotKey.key = 'P';
pisl->SetHotkey(hotKey.flags);
...but test it first, I'm just typing things into OE.
--
Jeff Partch [MVP]