Thread: Couple Questions, Editbox, ComboBox

  1. #1
    Join Date
    Oct 2004

    Couple Questions, Editbox, ComboBox

    1.) Edit Controls: I'v been skimmin through MSDN, and i believe this is what i want.
    I want a single line input box for numerical data and alpha strings. I always want to edit some of it.
    Now my question is, how can get the editbox window to give me the string it holds? Can you tell me the message or something so i can look it up? I'v browsed all of them.. over and over.. and i'm not sure what is what exactly. Could i just use EM_GETLINE on line zero to get the single line? (I assume that would work, but none the less i dunno if there is a better message for what i want to do)

    2.) ComboBox
    Again, having trouble with the message that would give me the string/item that is selected. I have a Dropdown box style Combo Box, and when a user clicks a button (just as with the edit box), the program retrieves the data from the combo box.
    Could you give me the message to get it?

    Thanks a ton, I'm getting close to understanding things better, i just do not understand what means what..

    3.) Like the combo box's message 'CB_GETITEMDATA', is that the item's string or data assocated with it? And if it is the data, does that mean by good practice and ease of use i should assign each string i assign some data so i can retrieve that? (for my uses though i would just assign the item name as the data also)

    Thanks to any replies explaining some things i'm not understandin
    01110111011000010110110001100100011011110010000001 11000101110101011010010111010000100000011011000110 10010110011001100101001000000111100101101111011101 0100100000011011100111010101100010

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    You can use the GetWindowText function to retrieve the text from either.

    TCHAR buf[500];
    GetWindowText(hwndEdit, buf, 500);
    Other functions that you may wish to look up are GetWindowTextLength (if you need to allocate a buffer for the text) and GetDlgItemText (if you have a control id rather than a hwnd for the control). Alternatively, you can use the WM_GETTEXT message directly.

    >> Like the combo box's message 'CB_GETITEMDATA', is that the item's string or data assocated with it? <<

    You can optionally associate an additional value with a combo box item. If you have no additional data to associate with a combo box item, there is no need to use this message.

  3. #3
    train spotter
    Join Date
    Aug 2001
    near a computer
    Or use SendMessage()


    Search MSDN for 'combo box messages'

    Many controls also have macros defined to do these kind of things

    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A couple questions
    By Flakster in forum C++ Programming
    Replies: 7
    Last Post: 08-09-2005, 01:22 PM
  2. Couple of simple directdraw questions.
    By Deo in forum Game Programming
    Replies: 3
    Last Post: 05-25-2005, 07:55 AM
  3. A couple of questions that someone might know the answer to...
    By Finchie_88 in forum A Brief History of
    Replies: 6
    Last Post: 04-15-2005, 08:26 AM
  4. Studying for Final, Couple Questions...
    By stewade in forum C Programming
    Replies: 4
    Last Post: 05-10-2004, 05:02 PM
  5. A couple questions
    By punkrockguy318 in forum Tech Board
    Replies: 4
    Last Post: 01-12-2004, 10:52 PM