Does bbSetBlitz3DEventCallback actually work (C#)

Blitz3D SDK Forums/Blitz3D SDK Programming/Does bbSetBlitz3DEventCallback actually work (C#)

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Ok, I have found the way to do it. I have posted the code just in case anybody else is stuck.


Delegate Declaration:
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate int dBBEventHandler(int hWnd, int Msg, int wParam, int lParam);
public dBBEventHandler BBEventHandler;



Assigning the handler to the SDK:
BBEventHandler = new dBBEventHandler(Engine_BBEventHandler);
bb.SetBlitz3DEventCallback(Marshal.GetFunctionPointerForDelegate(BBEventHandler).ToInt32());


Obviously you need to use System.Runtime.InteropServices