He aquí un programa de ejemplo para crear un cuadro de lista: #include using namespace std; LRESULT CALLBACK MainWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, lParam LPARAM) {switch (uMsg) {default: regresan DefWindowProc (hwnd, uMsg, wParam, lParam); } Return 0; } Int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {WCX WNDCLASSEX; wcx.cbSize = sizeof (WCX); wcx.style = CS_HREDRAW | CS_VREDRAW; wcx.lpfnWndProc = MainWndProc; wcx.cbClsExtra = 0; wcx.cbWndExtra = 0; wcx.hInstance = hInstance; wcx.hIcon = NULL; wcx.
hCursor = LoadCursor (NULL, IDC_ARROW); wcx.hbrBackground = (HBRUSH) (COLOR_BACKGROUND + 1); wcx.lpszMenuName = NULL; wcx.lpszClassName = "MainWClass"; wcx.hIconSm = NULL; RegisterClassEx (y WCX); HWND hwndMain; hwndMain = CreateWindowEx (0, "MainWClass", "Ventana principal", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL); si (hwndMain!) return false; ShowWindow (hwndMain, SW_SHOW); UpdateWindow (hwndMain); const char * cadena1 = "la primera cadena."; const char * str2 = "la segunda cadena."; const char * str3 = "la tercera cuerda.
"; const char * STR4 = "la cuarta cuerda."; const char * str5 = "la quinta cuerda."; HWND hwndLst; hwndLst = CreateWindowEx (0, "LISTBOX", NULL, WS_CHILD, 100, 100, 100, 150, hwndMain, (HMENU) 1, hInstance, NULL); ShowWindow (hwndLst, SW_SHOW); UpdateWindow (hwndLst); SendMessage (hwndLst, LB_ADDSTRING, NULL, (LPARAM) str1); SendMessage (hwndLst, LB_ADDSTRING, NULL, (LPARAM) str2); SendMessage (hwndLst, LB_ADDSTRING, NULL, (LPARAM) str3); SendMessage (hwndLst, LB_ADDSTRING, NULL, (LPARAM) STR4); SendMessage (hwndLst, LB_ADDSTRING, NULL, (LPARAM) str5); Msg MSG; BOOL Bret; while ((Bret = GetMessage (y msg, hwndMain, 0, 0)) = 0!) {if (Bret == -1) {//manejar el error y posiblemente salir de la aplicación} else {TranslateMessage (y msg); DispatchMessage (y msg); }} Return msg.
wParam; } Puede utili