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.