hello all,
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:
http://cboard.cprogramming.com/showt...752#post422752
here is my dialog callback:
Code:
BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg) {
case WM_INITDIALOG:
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 TRUE;
case WM_COMMAND:
switch(LOWORD(wParam)) {
default:
return DefWindowProc(hwndDlg, uMsg, wParam, lParam);
}
break;
case WM_CLOSE:
EndDialog(hwndDlg, 0);
return TRUE;
}
return FALSE;
}
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.
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!