void DInputClass::GetInput()
{
HRESULT hr = m_KeyboardDevice->GetDeviceState(sizeof(m_keyBuffer), (void**)&m_keyBuffer); //在這裡提示錯誤了
//獲取鍵盤輸入消息
if(hr)
{
m_KeyboardDevice->Acquire();
m_KeyboardDevice->GetDeviceState( sizeof(m_keyBuffer),(LPVOID)m_keyBuffer );
}
hr = m_MouseDevice->GetDeviceState(sizeof(DIMOUSESTATE), (void**)&m_MouseState);
//獲取鼠標輸入消息
if(hr)
{
m_MouseDevice->Acquire();
m_MouseDevice->GetDeviceState( sizeof(DIMOUSESTATE), (void**)&m_MouseState);
}
}
請問出了什麼問題?在其他的程序可以跑。。。
m_keyboarddevice估計不是正確的指針,你沒有正確獲取到。