Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.

Hadi Rezaie

DirectInput question ...

This topic is 6304 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all, I''m writing class for DirectInput8, one of my functions is GetKeys() ... This function should get all keys that user hited ... I wrote this function, but won''t work !!! void MyKeyboardTemplate::GetKey(HWND hWnd) { char i; TCHAR strResult[256*5 + 1] = TEXT(""); TCHAR strElement[10]; BYTE KeyBuffer[256]; ZeroMemory(&KeyBuffer, sizeof(KeyBuffer)); lpDIDevice->GetDeviceState(sizeof(KeyBuffer), (LPVOID)&KeyBuffer); lpDIDevice->Acquire(); for(i = 0; i < 256; i++) { if(KeyBuffer & 0x80) { wsprintf(strElement, "0x%02x", i); strcat(strResult, strElement); } } MessageBox(hWnd, strResult, "e", MB_ICONERROR); } In this function, i wanna only indicate keys to user, But in fact, this function must have return value ... I have other question, how can i change this function, to callback function ... Please help me ... Hadi Rezaie

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!