problem with win32 function SetWindowLong

BlitzMax Forums/BlitzMax Programming/problem with win32 function SetWindowLong

Mathieu A(Posted 2005) [#1]
Hi,
I've got an error when I compile my code:

Compiling:gui_example.bmx
[ERROR]: Compile Error: Unable to convert from 'Int(Int,Int,Int Ptr,Int Ptr)' to 'Int'
[ERROR]: [e:/blitzmaxbeta103/wingui/gui.bmx;451;1]
[ERROR]: Build Error: failed to compile e:/blitzmaxbeta103/wingui/gui_example.bmx

In fact the function SetWindowLong need a function for it ast parameter. But I don't know how we can put a function as parameter. If someone know it, tell me!

here is the code:
Type TButton Extends ButtonEvents

Method Create$(txt$,x,y,w,h,group)
Self.hwnd=CreateWindowEx_( Null, "BUTTON" , txt$ ,WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | BS_PUSHBUTTON ,x, y, w, h, group, Null ,GetModuleHandleA(Null), Null )
ButtonProc_=SetWindowLongA( Self.hwnd, GWL_WNDPROC, ButtonProc )
SendMessage_( Self.hwnd, WM_SETFONT, GetStockObject(DEFAULT_GUI_FONT), True )
Self.posx=x
Self.posy=y
Self.sizew=w
Self.sizeh=h
Self.oldwidth=w
Self.oldleft=x
FlushMem()
End Method

End Type

Function ButtonProc(hwnd:Int,msg:Int,wparam:Int Ptr,lparam:Int Ptr)
Select msg

Case 15
'Paint
buttonmsg_=15

Case 512
'Mouse Enter
buttonmsg_=512

Case $2A3
'Mouse Leave
buttonmsg_=$2A3

Case $2A1
'Mouse Enter
buttonmsg_=$2A1

Case 244
'Style Changed
buttonmsg_=244

Case 12
'Text Changed
buttonmsg_=12

Case 514
buttonmsg_=514

Case 7
buttonmsg_=7

Case 8
buttonmsg_=8

End Select

buttonhwnd_=hwnd

FlushMem()
Return CallWindowProcA( (ButtonProc_), hwnd, msg, wparam, lparam)
'Return buttonmsg_
'Return buttonhwnd_
End Function