主题:[讨论]大家看我这段代码有啥问题没
LRESULT CALLBACK WndProc(HWND hWnd,UINT message,UINT wParam,LONG lParam)
{
HDC hdc;
PAINTSTRUCT ps;
if(!RegisterHotKey(hWnd,1001,MOD_CONTROL,VK_A))
{
return FALSE;
}
switch(message)
{
case WM_DESTROY:
PostQuitMessage(0);
UnregisterHotKey(hWnd,1001);
break;
case WM_HOTKEY:
{
switch(wParam)
{
case 1001:
MessageBox(hWnd,"ss","ss",MB_OK);
break;
}
break;
}
case WM_PAINT:
hdc=BeginPaint(hWnd,&ps);
EndPaint(hWnd,&ps);
break;
default:
return DefWindowProc(hWnd,message,wParam,lParam);
}
}
注册热键,然后利用热键发送组合键命令
{
HDC hdc;
PAINTSTRUCT ps;
if(!RegisterHotKey(hWnd,1001,MOD_CONTROL,VK_A))
{
return FALSE;
}
switch(message)
{
case WM_DESTROY:
PostQuitMessage(0);
UnregisterHotKey(hWnd,1001);
break;
case WM_HOTKEY:
{
switch(wParam)
{
case 1001:
MessageBox(hWnd,"ss","ss",MB_OK);
break;
}
break;
}
case WM_PAINT:
hdc=BeginPaint(hWnd,&ps);
EndPaint(hWnd,&ps);
break;
default:
return DefWindowProc(hWnd,message,wParam,lParam);
}
}
注册热键,然后利用热键发送组合键命令