;********************************************************************
; Windows API Controls for GLpro
; Example by G-media
;********************************************************************
; Run ddemo.txt!
return

;**************************************
itemgettext: declare itemname
;**************************************
setupdll int GetDlgItemText handle int farptr int
alloc tmpbuf 1024
GetDlgItemText(@winhandle,@("id"$@itemname),@tmpbuf,1024)
local rtmp @@tmpbuf$""
free tmpbuf
return @rtmp


;**************************************
itemsettext: declare itemname itemtxt
;**************************************
setupdll void SetDlgItemText handle int farstring
return SetDlgItemText(@winhandle,@("id"$@itemname),@itemtxt)


;**************************************
winbutton: declare x y xs ys itemname itemid btntxt
;**************************************
setupdll handle CreateWindow farstring farstring ulong int int int int handle handle handle farstring
local flags @WS_VISIBLE|@WS_BORDER|@WS_CHILD
global "id"$@itemname @itemid
global "h"$@itemname CreateWindow("Button",@btntxt,@flags,@x,@y,@xs,@ys,@winhandle,@("id"$@itemname),@wininstance,@NULL)
return


;**************************************
wincheck: declare x y xs ys itemname itemid btntxt
;**************************************
setupdll handle CreateWindow farstring farstring ulong int int int int handle handle handle farstring
local flags @WS_VISIBLE|@WS_CHILD|3
global "id"$@itemname @itemid
global "h"$@itemname CreateWindow("Button",@btntxt,@flags,@x,@y,@xs,@ys,@winhandle,@("id"$@itemname),@wininstance,@NULL)
return


;**************************************
winedit: declare x y xs ys itemname itemid btntxt
;**************************************
setupdll handle CreateWindow farstring farstring ulong int int int int handle handle handle farstring
local flags @WS_VISIBLE|@WS_BORDER|@WS_CHILD
global "id"$@itemname @itemid
global "h"$@itemname CreateWindow("Edit",@btntxt,@flags,@x,@y,@xs,@ys,@winhandle,@("id"$@itemname),@wininstance,@NULL)
return


;**************************************
listbox: declare x y xs ys itemname itemid
;**************************************
setupdll handle CreateWindow farstring farstring ulong int int int int handle handle handle farstring
setupdll bool DestroyWindow handle
local flags @WS_VISIBLE|@WS_BORDER|@WS_CHILD|0x00200000
global "id"$@itemname @itemid
global "h"$@itemname CreateWindow("ListBox",@itemname,@flags,@x,@y,@xs,@ys,@winhandle,@("id"$@itemname),@wininstance,@NULL)
return


;**************************************
combobox: declare x y xs ys itemname itemid
;**************************************
setupdll handle CreateWindow farstring farstring ulong int int int int handle handle handle farstring
setupdll bool DestroyWindow handle
local flags @WS_VISIBLE|@WS_BORDER|@WS_CHILD|0x0001|@WS_TABSTOP|0x00200000
global "id"$@itemname @itemid
global "h"$@itemname CreateWindow("ComboBox",@itemname,@flags,@x,@y,@xs,@ys,@winhandle,@("id"$@itemname),@wininstance,@NULL)
return


;**************************************
listboxadd: declare itemname addtxt
;**************************************
setupdll ulong SendDlgItemMessage handle int uint uint fs
setupdll long SendDlgItemMessage SendDlgItemMessageB handle int uint uint ulong
SendDlgItemMessage @winhandle @("id"$@itemname) 0x400+1 0 @addtxt
return	


;**************************************
getcursel: declare itemname
;**************************************
setupdll ulong SendDlgItemMessage handle int uint uint fs
setupdll long SendDlgItemMessage SendDlgItemMessageB handle int uint uint ulong
return SendDlgItemMessageB(@winhandle,@("id"$@itemname),0x400+9,0,0)

;**************************************
getbtnstate: declare itemname
;**************************************
setupdll ulong SendDlgItemMessage handle int uint uint fs
setupdll long SendDlgItemMessage SendDlgItemMessageB handle int uint uint ulong
return SendDlgItemMessageB(@winhandle,@("id"$@itemname),0x400+2,0,0)



;**************************************
deleteitem: declare itemname
;**************************************
setupdll bool DestroyWindow handle
DestroyWindow @("h"$@itemname)
return



;**************************************
registerbwcc:
;**************************************
loadlib bwcc.dll
setupdll @bwcc int BWCCMessageBox handle fs fs uint
setupdll @bwcc bool BWCCRegister handle
BWCCRegister @WININSTANCE
return

;**************************************
bwccmessage: declare msg title type
;**************************************
BWCCMessageBox @winhandle @msg @icon @type
return


;**************************************
ctl3dauto:
;**************************************
loadlib ctl3d.dll
setupdll @ctl3d bool Ctl3dAutoSubclass handle
Ctl3dAutoSubclass @WININSTANCE
return








