Jump to content
  • Advertisement
Sign in to follow this  
BlackJoker

Connect native DirectInput (DX 11) to WPF window

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

I have game engine based on native C++ and DirectX 11 and work as separate process (.exe)

On the other side I have WPF application which communicate with engine via socket. On the start I create a WPF window and send HWND and HInstance to my engine.

D3D11 output rendered image to my WPF window without problems, but DirectInput doesn`t work at all.

I want to know what I am doing wrong? How to link WPF window to native DirectInput considering my situation? Need I create any events on WPF side or something else?

I know that in my WinAPI window I don`t use any window events to make DirectInput work, but have no idea how to make work it with WPF window.

Please, help me to solve this problem!

 

EDIT:
I find out that DirectInput8 function failed to initialize DI and return E_INVALIDARG. I think that this is because of invalid hInstance, but I think I receive correct hInstance:



IntPtr hInstance = Marshal.GetHINSTANCE(GetType().Module);

Is this correct for WPF? Does anyone knows?

 

And in my parser I do the following:

unsigned int hInstance;
HINSTANCE inst;
hInstance = atoi(str); //str -  hinstance in char* format
inst = (HINSTANCE)(void*)hInstance;

and then pass result to DirectInput.

Edited by BlackJoker

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!