我正在尝试获取扩展密钥状态
WNDPROC lpfnEditWndProc;
//edit - hwnd of edit control
lpfnEditWndProc = (WNDPROC) SetWindowLong(edit, GWL_WNDPROC, (DWORD) SubClassProc);
struct Bits {
WORD nRepeatCount: 16;
BYTE nScanCode : 8;
BYTE nExtended : 1;
BYTE nReserved : 4;
BYTE nContext : 1;
BYTE nPrevious : 1;
BYTE nTransition : 1;
};
union KeyInfo
{
LPARAM lParam;
Bits bits;
};
LRESULT CALLBACK SubClassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
case WM_CHAR:
{
KeyInfo v;
v.lParam = lParam;
printf("nExtended = %d\n", v.bits.nExtended);
}
break;
}
return CallWindowProc(lpfnEditWndProc, hwnd, msg, wParam, lParam);
}
n 始终扩展 == 0
我试图以不同的方式输出信息,比如(lParam << 24) & 1;
都一样 nExtended == 0
Win7 64 位,Visual Studio 2010