Topic: HWND in Byte PTR?

Hi,

I'm new to Blitzmax, and I try to bind Maxgui with 3Impact.

The idea is to open a 3Impact window in a Maxgui window in order to control 3impact from MAxgui gadgets.

Local w:TGadget = CreateWindow("Easy GL Cube in a GUI window", 10, 10, 1024+10, 768+10 )
Local c:TGadget = CreateCanvas(0,0,w.ClientWidth(),w.ClientHeight(),w,0)
Local hwnd:Int = QueryGadget(c,QUERY_HWND)
If Not i3ImpactOpen(hwnd,hwnd) RuntimeError "Unable to initialize the 3Impact game engine"


THE PROBLEM!

You always use BYTE PTR for passing the HWND to i3ImpactOpen, that generate an error "Unable to convert from Int to Byte Ptr" at compile.

Why using Byte PTR when windows handles are int?

I'm stuck

Re: HWND in Byte PTR?

greetings nikko smile  anything in BMAX can be cast to a Byte Ptr.  the byte ptr is there to help you from passing something you werent wanting to pass like a real int value.  to cast something in BMAX you wrap what you are casting with the syntax 'Type(var)'.  to get the code to do what you want change to this:

Local w:TGadget = CreateWindow("Easy GL Cube in a GUI window", 10, 10, 1024+10, 768+10 )
Local c:TGadget = CreateCanvas(0,0,w.ClientWidth(),w.ClientHeight(),w,0)
Local hwnd:Int = QueryGadget(c,QUERY_HWND)
If Not i3ImpactOpen(Byte Ptr(hwnd),Byte Ptr(hwnd)) RuntimeError "Unable to initialize the 3Impact game engine"

in addition, this has already been tried out.  here are some related threads:

http://www.blitzmax.com/Community/posts … 171#594384

http://www.3impact.com/3Impact_Engine/f … pic=1313.0