well since I finally got a working dialog box with the API, today I figured I'd try adding a listview control to it.
first of all let me tell you how I created the listview control. I created it in my dialog with the Visual C++ visual resource editor (APSTUDIO I believe its called, I am sure you know what I mean). I am using the Win32 API, but instead of hardcoding my resource files, I prefer to use the built in tool in Visual C++.
I tried adding a column based on code I seen posted here:
here is my dialog callback:
I know its very simple code, I am just trying to see if I can get something looking the way I want it. hwndList is an HWND global, and lvCol is an LVCOLUMN global. it compiles fine, but when I run it, the column does not get added.
BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
hwndList = GetDlgItem(hwndDlg, IDC_LIST);
ListView_SetExtendedListViewStyle(hwndList, LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP);
lvCol.mask = LVCF_TEXT | LVCF_SUBITEM | LVCF_WIDTH | LVCF_FMT;
lvCol.fmt = LVCFMT_LEFT;
lvCol.iSubItem = 0;
lvCol.cx = 200;
lvCol.pszText = "File";
ListView_InsertColumn(hwndList, 0, &lvCol);
return DefWindowProc(hwndDlg, uMsg, wParam, lParam);
would anyone here be able to tell me why this isn't working? I realize the listview control in the above link I posted was created with CreateWindow(), but I don't see why that would matter here (or maybe it does?). using CreateWindow() would make this harder, since I would need to set the dimensions to properly display it in the dialog.
any help is greatly appreciated as always.
thank you in advance!