Details/Report view is what I am going for. When I first started working on it, within my actual project, I added two columns, yes. When nothing came up, I figured I was doing it wrong, so I opened a test project to experiment with the control a bit, and since I decided to start with just a single column in the test, I did not add any columns. Are column inserts required when only a single column is being used?
Here's the more important bits of code from the test project...
Code:
HWND hList = CreateWindowEx(WS_EX_OVERLAPPEDWINDOW, WC_LISTVIEW, NULL,
WS_CHILD | WS_VISIBLE | LVS_REPORT,
0, 0, 300, 300,
hwnd, 0, hInstance, NULL);
if(hList == NULL)
{
printf("CreateWindowEx() Failure\n");
return 0;
}
LVITEM ItemInfo;
ZeroMemory(&ItemInfo, sizeof(ItemInfo));
ItemInfo.mask = LVIF_TEXT;
ItemInfo.iSubItem = 0;
ItemInfo.iItem = 0;
ItemInfo.pszText = "Test Account #1";
ItemInfo.cchTextMax = 20;
uint result = SendMessage(hList, LVM_INSERTITEM, 0, (LPARAM)&ItemInfo);
if(result == -1)
printf("LVM_INSERTITEM Failure\n");
else
printf("LVM_INSERTITEM Success: %i\n", result);
SendMessage(hList, LVM_SETITEMTEXT, 0, (LPARAM)&ItemInfo);
ItemInfo.iItem = 1;
ItemInfo.pszText = "Test Account #2";
ItemInfo.cchTextMax = 20;
result = SendMessage(hList, LVM_INSERTITEM, 0, (LPARAM)&ItemInfo);
if(result == -1)
printf("LVM_INSERTITEM Failure\n");
else
printf("LVM_INSERTITEM Success: %i\n", result);
SendMessage(hList, LVM_SETITEMTEXT, 1, (LPARAM)&ItemInfo);
ItemInfo.iItem = 2;
ItemInfo.pszText = "Test Account #3";
ItemInfo.cchTextMax = 20;
result = SendMessage(hList, LVM_INSERTITEM, 0, (LPARAM)&ItemInfo);
if(result == -1)
printf("LVM_INSERTITEM Failure\n");
else
printf("LVM_INSERTITEM Success: %i\n", result);
SendMessage(hList, LVM_SETITEMTEXT, 1, (LPARAM)&ItemInfo);
Note that I have called InitCommonControlsEx().