Does anyone know how to insert items into a combobox that was created with the createwindow API?
Printable View
Does anyone know how to insert items into a combobox that was created with the createwindow API?
It should be something similar to this, didn't test it so you may have to fool around with it to get it to work..
Where lHWND is the handle to your combo box.Code:
Call SendMessage(lHWND, LB_ADDSTRING, 0, "HELLO")
I have been trying to get that sendmessage to work and still seem to be having problems with it. I have tried:
SendMessage myComboBox, CB_ADDSTRING, 0, "HELLO" and
Call SendMessage (myComboBox, CB_ADDSTRING, 0, "HELLO")
with no luck in either one.
If it helps any, I have this combo box sitting in the quicklaunch menu on the taskbar. Could this have anything to do with it? Would I have to get the device context or something along this line in order to manipulate the contents of the combobox?
I was trying to do the same thing to speed up my app.....YoungBuck got me on the right track.....heres the code I got to work using the API.
Code:
Sub Form_Load()
dim i as Integer
With Combo1
For i = 0 To Printer.FontCount - 1
SendMessage .hWnd, CB_ADDSTRING, 0, ByVal Printer.Fonts(i)
Next i
.ListIndex = 0
End With
End Sub
Hope this helps :)
You need the ByVal keyword.
Code:Call SendMessage(lHWND, LB_ADDSTRING, 0, ByVal "HELLO")