Jump to content
  • Advertisement

Archived

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

eskerchin

Can DirectMouse use with MFC?

This topic is 6467 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

Hello! Could anybody tell me how to implement DirectMouse in MFC? void initDMouse(HWND hDlg,HINSTANCE hInst) { HRESULT hr; hr=DirectInputCreate(hInst, DIRECTINPUT_VERSION, &pDI, NULL ); if ( FAILED(hr) ) showErrMsg(ErrInitDinput,TRUE); hr=pDI->CreateDevice(GUID_SysMouse,&pMouse,NULL); if ( FAILED(hr) ) showErrMsg(ErrInitDinput,TRUE); hr = pMouse->SetDataFormat(&c_dfDIMouse); if ( FAILED(hr) ) showErrMsg(ErrInitDinput,TRUE); hr = pMouse->SetCooperativeLevel( hDlg, DISCL_EXCLUSIVE|DISCL_FOREGROUND); if ( FAILED(hr)) showErrMsg(ErrInitDinput,TRUE); } This is my code of initialization. I have tried a lot of methods such as initDMouse(AfxGetMainWnd()->GetSafeHwnd(), ::AfxGetInstanceHandle( )); to pass HINSTANCE and HWND value to the function, but it still didn''t have response. All works in API but not MFC. I don''t know why this would happen. Please help!

Share this post


Link to post
Share on other sites
Advertisement
This doesn''t really have to do with music/audio, move it to a different forum like the DirectX one to get an answer.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!