我想在 C++ 中创建一个 ListView。到目前为止我的代码:
InitCommonControls(); // Force the common controls DLL to be loaded.
HWND list;
// window is a handle to my window that is already created.
list = CreateWindowEx(0, (LPCSTR) WC_LISTVIEWW, NULL, WS_VISIBLE | WS_CHILD | WS_BORDER | LVS_SHOWSELALWAYS | LVS_REPORT, 0, 0, 250, 400, window, NULL, NULL, NULL);
LVCOLUMN lvc;
lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
lvc.iSubItem = 0;
lvc.pszText = "Title";
lvc.cx = 50;
lvc.fmt = LVCFMT_LEFT;
ListView_InsertColumn(list, 0, &lvc);
但是如果我编译并执行代码,只会显示一个空白窗口。编译器:Windows 7 (x86) 上的 MinGW。
任何人都可以帮我正确显示列表视图吗?