#include once "window9.bi"

Function ComboBoxImageGadget(ByVal gadget As Long, _
							ByVal x As Long, ByVal y As Long, _
							ByVal w As long, ByVal h As Long, _
							ByVal SizeIcon As Long=16, _
							ByVal Style As Long=CBS_DROPDOWNLIST Or WS_VSCROLL) As HWND Export
	Dim As hImageList hImageList
	Var hWin= CreateWindowEx( 0, "ComboBoxEx32", "", WS_CHILD Or WS_VISIBLE Or Style, x,y,w,h, Cast(HWND,win9GetCurrent()), Cast(HMENU,CInt(gadget)),0,0)
	win9AddNewGadget (gadget,hWin)
	win9AddColor(hWin,16777215,0)
	win9SetCurrentColors(16777215,0)
    dim as hwnd hwParent = Cast(HWND,win9GetCurrent())
    for i as Long = 0 to 1000
        dim as USTRING sz = getclassname_(hwParent)
        if instr(sz , "CLASSCLASS_") andalso getparent(hwParent) = 0 then
            if getprop(hwParent , "tabstopenable") then
                win9AddTabStop(hwParent , gadget)
            EndIf
            exit for
        else
            hwParent = getparent(hwParent)
            if hwParent = 0 then exit for
        EndIf
    Next
	If win9GetGadgetFont()<>0 Then SendMessage(Cast(HWND,hWin),WM_SETFONT,win9GetGadgetFont(),0)
	hImageList = ImageList_Create(SizeIcon,SizeIcon,ILC_COLOR32,1,1)
	SetProp(hWin,"addparam60000",hImageList)
	SendMessage(Cast(HWND,hWin), CBEM_SETIMAGELIST, 0,Cast(LPARAM, hImageList))
	Return hWin
End Function

Function GetHimageCombo_(ByVal gadget As integer) As Integer
	Return cast(integer,GetProp(GadgetID(gadget),"addparam60000"))
End Function

