[solved] MOIS Runtime error

totenhose

17-12-2007 14:42:31

Hi,

I'm trying to get joystick work in MOgre application with MOIS. I created inputsystem and the joystick is listed with ListFreeDevices() command. But if i run the code with part where the joystick object is created, the application gives runtime error:

System.Runtime.InteropServices.SEHException: External component has thrown an exception.
at OIS.InputManager.createInputObject(InputManager* , Type , Boolean , basic_string<char\,std::char_traits<char>\,std::allocator<char> >* )

The code:


int windowHnd = 0;
mogreWin.window.GetCustomAttribute("WINDOW", out windowHnd);
inputManager = MOIS.InputManager.CreateInputSystem((uint)windowHnd);

joystick = (MOIS.JoyStick)inputManager.CreateInputObject(MOIS.Type.OISJoyStick, true);


I tried to create keyboard instead, but same error. Does anyone have a clue what can be wrong?

Thx

GermanDZ

17-12-2007 22:21:52

It seams to be a problem with the Handler of the window.

MOIS requires the handler of the MainAppWindow. So, if you have a multi-window APP (some toolbars, many toolbox, a 3DPanel within a form or something like that), you must pass the TOP FORM Handler to MOIS.

If you can't do it work, post the code of window creation.

totenhose

18-12-2007 12:57:57

DZ, you're the man!
It works now if i use the form's handle.


MOIS.ParamList pl = new MOIS.ParamList();
pl.Insert("WINDOW", this.Handle.ToString());
inputManager = MOIS.InputManager.CreateInputSystem(pl);