Sign in to follow this  

Connect native DirectInput (DX 11) to WPF window

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!


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 = 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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this