Results 1 to 5 of 5

Thread: Inserting items into a combo box created with API calls

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Location
    Charleston, S.C.
    Posts
    21
    Does anyone know how to insert items into a combobox that was created with the createwindow API?

  2. #2
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Bethel, North Carolina, USA
    Posts
    987
    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..

    Code:
     Call SendMessage(lHWND, LB_ADDSTRING, 0, "HELLO")
    Where lHWND is the handle to your combo box.
    {Insert random techno-babble here}

    {Insert quote from some long gone mofo here}

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Location
    Charleston, S.C.
    Posts
    21
    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?

  4. #4
    Lively Member
    Join Date
    Mar 2000
    Location
    U.S.A.
    Posts
    75

    Cool

    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

  5. #5
    Guest
    You need the ByVal keyword.
    Code:
    Call SendMessage(lHWND, LB_ADDSTRING, 0, ByVal "HELLO")

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width