Help with input [Solved]


26-09-2007 14:22:22

I'm trying to get the following code to work in VB.NET with mogre:

LogManager.Singleton.LogMessage("*** Initializing OIS ***")
Dim pl As MOIS.ParamList = New MOIS.ParamList()
Dim windowHnd As IntPtr

WINDOW.GetCustomAttribute("WINDOW", windowHnd)
pl.Insert("WINDOW", windowHnd.ToString())
inputManager = MOIS.InputManager.CreateInputSystem(pl)

'Create all devices (We only catch joystick exceptions here, as, most people have Key/Mouse)
inputKeyboard = inputManager.CreateInputObject(MOIS.Type.OISKeyboard, False)
inputMouse = inputManager.CreateInputObject(MOIS.Type.OISMouse, False)

But the line: WINDOW.GetCustomAttribute("WINDOW", windowHnd) cause an error that says: Object reference not set to an instance of an object

Not sure what to do.
Window is defined earlier as: Public WINDOW As RenderWindow



26-09-2007 17:31:06

That's because windowHnd is empty.

You have to do something like windowHnd = Form1.Handle


26-09-2007 22:16:40

I'm confused, I thought the idea was to pass GetCustomAttribute a variable to put the window handle in. Isn't that how you get the window handle.

There is no form1, there is only an Ogre Window named "Window"

This code works in C#, in fact is was coppied from example.cs
it's just reformated for, but it doesn't work.

Help please


26-09-2007 22:26:31

I think the problem is Window is set to nothing in my watch window, so as a result:

MsgBox(WINDOW.GetType) causes the same error.
I don't understand, I can see the Ogre window already before the error happens, why is it set to nothing causing a Null Reference error.


26-09-2007 23:03:10


The window I'm seeing is defined with a different name:
Private mRenderWin As RenderWindow

When I insert that name I don't get the null ref error.