// Добавляем списки изображений ListView_SetImageList(hwndList, himlSmall, LVSIL_SMALL); ListView_SetImageList(hwndList, himlLarge, LVSIL_NORMAL);
// Вставляем столбцы memset(&lvc, 0, sizeof(lvc));
lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; lvc.fmt = LVCFMT_LEFT; lvc.cx = (rc.right - rc.left) / 4;
lvc.iSubItem = 0; lvc.pszText = "Application Name"; ListView_InsertColumn(hwndList, 0, &lvc);
lvc.iSubItem = 1; lvc.pszText = "Icon Name"; ListView_InsertColumn(hwndList, 1, &lvc);
lvc.iSubItem = 2; lvc.pszText = "Cost, USD"; ListView_InsertColumn(hwndList, 2, &lvc); ListView_SetColumnWidth(hwndList,2,(rc.right-rc.left) / 8);
// Вставляем строки memset(&lvi, 0, sizeof(lvi));
lvi.mask = LVIF_IMAGE | LVIF_TEXT | LVIF_PARAM; lvi.pszText = LPSTR_TEXTCALLBACK;
for(i=0; i<9; i++) { lvi.iItem = i; lvi.iSubItem = 0; lvi.cchTextMax = 40; lvi.lParam = (LPARAM)&rgApplInfo[i];
lvi.iImage = i; ListView_InsertItem(hwndList, &lvi);
lvi.iItem = i; lvi.iSubItem = 1; ListView_InsertItem(hwndList, &lvi);
lvi.iItem = i; lvi.iSubItem = 2; ListView_InsertItem(hwndList, &lvi); } return TRUE; }
// ----------------------------------------------------- // Функция WndProc_OnDestroy // ----------------------------------------------------- #pragma warning(disable: 4098) void WndProc_OnDestroy(HWND hWnd) { DestroyWindow(hwndList); PostQuitMessage(0); return 0L; }
// ----------------------------------------------------- // Функция WndProc_OnCommand // ----------------------------------------------------- #pragma warning(disable: 4098) void WndProc_OnCommand(HWND hWnd, int id, HWND hwndCtl, UINT codeNotify) { DWORD dwStyle = 0; switch (id) { case ID_OPTIONS_ICONVIEW: { dwStyle = GetWindowLong(hwndList, GWL_STYLE); if((dwStyle & LVS_TYPEMASK) != LVS_ICON) SetWindowLong(hwndList, GWL_STYLE, (dwStyle & ~LVS_TYPEMASK) | LVS_ICON); break; }
case ID_OPTIONS_SMALLICONVIEW: { dwStyle = GetWindowLong(hwndList, GWL_STYLE);