ListBox で選択した MessageBox テキストに表示するにはどうすればよいですか? 次のコードを使用しようとしましたが、空の MessageBox しか表示されません
wchar_t listBoxStr[15];
HWND hWndList;
switch (message)
{
case WM_CREATE:
hWndList = CreateWindowEx(WS_EX_CLIENTEDGE, TEXT("listbox"), "", WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_AUTOVSCROLL, 240, 40, 150, 20, hwnd, (HMENU)105, NULL, NULL);
SendMessage(hWndList, LB_ADDSTRING, 0, (LPARAM)"name");
SendMessage(hWndList, LB_ADDSTRING, 0, (LPARAM)"extension");
SendMessage(hWndList, LB_ADDSTRING, 0, (LPARAM)"date");
SendMessage(hWndList, LB_ADDSTRING, 0, (LPARAM)"size");
CreateWindowEx(NULL, TEXT("button"), TEXT("FIND"), WS_VISIBLE | WS_CHILD, 410, 40, 50, 20, hwnd, (HMENU)106, NULL, NULL);
return 0 ;
return 0 ;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case 106:
SendMessageW(hWndList, LB_GETTEXT,0,(LPARAM)listBoxStr);
MessageBoxW(NULL, listBoxStr, L"", NULL);
return 0;
}
return 0;
case WM_PAINT:
hdc = BeginPaint (hwnd, &ps);
GetClientRect (hwnd, &rect) ;
EndPaint (hwnd, &ps) ;
return 0 ;
case WM_DESTROY:
PostQuitMessage (0) ;
return 0 ;
}