這是我的代碼: -鼠標點擊向我發送消息多次在C++
DWORD WINAPI ThreadMouse(void* data){
while (1){
//Check the mouse left button is pressed or not
if ((GetKeyState(VK_LBUTTON) & 0x8000) != 0)
{
MessageBox(NULL, L"Left Clicked", L"", NULL);
break;
}
//Check the mouse right button is pressed or not
if ((GetKeyState(VK_RBUTTON) & 0x100) != 0)
{
MessageBox(NULL, L"Right Clicked", L"", NULL);
break;
}
}
return 0;
}
我收到消息多次,而不是一次
也許當你點擊*關閉'MessageBox'時,你觸發了一個新的鼠標事件? – Galik
當我點擊鼠標左鍵時,一旦所有消息框出現 –
我不知道WINAPI,但它可能是'鼠標按下'和'鼠標按下'兩個事件嗎? – Zereges