#include once "window9.bi"

sub AddComboBoxImageItem(ByVal gadget As long, ByRef txt As USTRING, ByVal IDImage_ As HBITMAP, ByVal pos_ As Long) Export
	Dim CBITEM As COMBOBOXEXITEM
	Dim As Integer ppoos  = ImageList_Add(Cast(HIMAGELIST, GetHimageCombo_(gadget)), Cast(HBITMAP,IDImage_),0)
	#ifdef UNICODE
		CBITEM.pszText        =  cast(any ptr , *txt)
	#else	
		CBITEM.pszText        = Cast(LPSTR, StrPtr(txt))
	#EndIf	
	CBITEM.iItem          = pos_
	CBITEM.iImage         = ppoos
	CBITEM.iSelectedImage = ppoos
	CBITEM.cchTextMax     = Len(txt)
	CBITEM.mask           = CBEIF_TEXT or CBEIF_IMAGE or CBEIF_SELECTEDIMAGE
	SendMessage(Cast(HWND,GadgetID(gadget)) , CBEM_INSERTITEM, 0, Cast(LPARAM,@CBITEM))
	DeleteObject(Cast(HGDIOBJ,ppoos))
End Sub
