Advertisement

Win32 listbox problem

Started by March 30, 2001 12:07 PM
3 comments, last by Rudan 23 years, 10 months ago
Allright, I''ve searched the MSDN Library like crazy but I can''t find the answer to this problem(Which is a bit strange, since I''m sure it''s there somewhere...) How do I add items to a listbox? As the title says, I''m using the win32 api... Thanks
-----------------------------Reporter: Are they slow-moving, chief?Sheriff: Yeah, they're dead. They're all messed up.-Night of the living dead
You need to use the SendMessage function. This function takes four parameters. In your case the first parameter is a handle to the listbox. For the second parameter you will use LB_ADDSTRING. The third parameter must be zero. For the fourth parameter send the address of the string you wish to add.

Here is an example.

TCHAR *pstringvar;
SendMessage(hwndlist, LB_ADDSTRING, 0, (LPARAM) pstringvar);

Hope this helps

-Will
Advertisement
SendMessage(ListboxHandle, LB_ADDSTRING, 0, (LPARAM)"SomeString");

Doh, you beat me by exactly a minute.

Thanks!
-----------------------------Reporter: Are they slow-moving, chief?Sheriff: Yeah, they're dead. They're all messed up.-Night of the living dead

This topic is closed to new replies.

Advertisement