Your code does the right thing for me.
Do you have some other code that you've not shown?
about creating listbox in vs2019
Tom Chen
1
Reputation point
When I created listbox using the following code, I got an unexpected wrong listbox as the picture shown.
-----------------------------
case WM_CREATE:
//
hListBox = CreateWindowW(_T("LISTBOX"), NULL, WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP| LBS_STANDARD,
20, 20, 260, 280,
hWnd, (HMENU)10000,
(HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE),
NULL);
SendMessage(hListBox, LB_ADDSTRING, 0, (LPARAM)_T("China"));
SendMessage(hListBox, LB_ADDSTRING, 0, (LPARAM)_T("America"));
SendMessage(hListBox, LB_ADDSTRING, 0, (LPARAM)_T("England"));
break;
-------------------------------------------
Windows development | Windows API - Win32
1 answer
Sort by: Most helpful
-
David Lowndes 4,726 Reputation points
2021-01-18T09:08:49.36+00:00