listbox question

This is a discussion on listbox question within the Windows Programming forums, part of the Platform Specific Boards category; Hey I have to make this quick cause I have to leave pretty soon. So I was wondering if there ...

  1. #1
    That weird Java guy xniinja's Avatar
    Join Date
    Jun 2010
    Posts
    230

    listbox question

    Hey I have to make this quick cause I have to leave pretty soon.
    So I was wondering if there is any way to add a char to a listbox control, I tried SendMessage but it doesn't work
    thanks in advance.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,489
    Posting an example of what you're doing, and what you tried would be better.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,239
    It's not possible. Listboxes are designed to just sit there displaying nothing.

    EDIT: To be less sarcastic, you might start by explaining what you mean by "adding a char" to a listbox.
    Last edited by brewbuck; 07-06-2010 at 11:11 PM.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  4. #4
    Registered User
    Join Date
    Dec 2007
    Posts
    214
    Hey I have to make this quick cause I have to leave pretty soon.

    If you can set aside the time to do a Google (or your favorite search engine) search you'd find many, many results. Any basic tutorial using listboxes in whatever language you are using would have this info.

  5. #5
    That weird Java guy xniinja's Avatar
    Join Date
    Jun 2010
    Posts
    230
    this is what I am trying

    Code:
    hwndlistbox = CreateWindow(TEXT("Listbox"), NULL, WS_CHILD | WS_VISIBLE | WS_BORDER | ES_MULTILINE,
    				50, 70, 170, 140, hwnd, (HMENU) ID_EDIT,
    				NULL, NULL);
                    char buff1[50];
                    pfile = fopen("C:\\reminder\\data\\backup1.xls", "r");
                    while(fgets(buff1,50, pfile))
    {
       SendMessage(hwndlistbox, LB_ADDSTRING, 0, (LPARAM)buff1);
    }
    And please don't be a hater just because I said I have to make this quick.

  6. #6
    Registered User
    Join Date
    Dec 2007
    Posts
    214
    In the CreateWindow for the listbox : Take off the ES_MULTILINE style. Add in LBS_STANDARD style.



    Edit : Also remove WS_BORDER, as it is added with LBS_STANDARD.


    Edit 2 : If you had taken the time to post that snippet of code first, your solution could have been found sooner.
    Last edited by DaveH; 07-07-2010 at 12:00 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A question about a question
    By hausburn in forum C++ Programming
    Replies: 3
    Last Post: 04-25-2010, 05:24 AM
  2. SDL buffer channels question
    By TriKri in forum Game Programming
    Replies: 3
    Last Post: 12-09-2009, 04:52 PM
  3. Newbie question, C #
    By mate222 in forum C# Programming
    Replies: 4
    Last Post: 12-01-2009, 05:24 AM
  4. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  5. Lame question on dialog controls appearance
    By Templario in forum Windows Programming
    Replies: 2
    Last Post: 03-18-2003, 07:22 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21