WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Dialog Boxes

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

A script that displays a ComboBox inside a WB box

Keywords: 	 combobox udf

A script that displays a ComboBox inside a WB box.

;ComboBox inside boxes
;Control manager
AddExtender("WWCTL34I.DLL")

;ComboBox UDF
;Id    : identifier for combobox
;x     : pixels from left of parent window
;y     : pixels from top of parent window
;Width : widht in pixels
;Height: height in pixels
#DefineFunction combobox(Id, x, y, Width, Height)
hWndParent = DLLhWnd("")
hInstance = DLLhInst("")
sDLLName = StrCat(DirWindows(1), "User32.DLL")
handle = DLLCall(sDLLName,long:"CreateWindowExA",long:512,lpstr:"ComboBox",long:0,long:2|16384 << 16|1 << 16|4096 << 16|32 << 16|128|2 << 16,long:x,long:y,long:Width,long:Height,long:hWndParent,long:Id,long:hInstance,long:0)
Return handle
#EndFunction 

;Message to add an item
CB_ADDSTRING = 323

;Create combobox
boxopen("ComboUDF",strcat(@crlf, @crlf, "CTRL to select.", @crlf, "SHIFT to exit."))
handle = combobox(1, 10, 10, 200, 100)

;Add items
IntControl(22, handle, CB_ADDSTRING, 0, "Blue")
IntControl(22, handle, CB_ADDSTRING, 0, "Red")
IntControl(22, handle, CB_ADDSTRING, 0, "Green")

;You can set an item at the begining
cSetEditText(handle, "Blue")

While 1
  If Iskeydown(@ctrl)==@true
    ;Get selection
    text = cGetEditText(handle)  
    message("Choice:",text)
  EndIf
  If Iskeydown(@shift)==@true Then Exit
EndWhile

Article ID:   W15008
File Created: 2001:11:08:12:41:20
Last Updated: 2001:11:08:12:41:20