PDA

Click to See Complete Forum and Search --> : Inserting items into a combo box created with API calls


percidae
Jan 1st, 2001, 05:42 PM
Does anyone know how to insert items into a combobox that was created with the createwindow API?

YoungBuck
Jan 1st, 2001, 10:38 PM
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..



Call SendMessage(lHWND, LB_ADDSTRING, 0, "HELLO")



Where lHWND is the handle to your combo box.

percidae
Jan 2nd, 2001, 12:08 AM
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?

Mithyrl
Jan 30th, 2001, 02:08 PM
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.



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 :)

Jan 30th, 2001, 02:19 PM
You need the ByVal keyword.

Call SendMessage(lHWND, LB_ADDSTRING, 0, ByVal "HELLO")