From 2b8b6ac284dca2bd22514d293519cb877a1079d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Fri, 29 Jul 2022 21:20:44 +0200 Subject: Add ListView::FindNextItem. This makes it much more ergonomic and less error-prone to look up list view items. --- c/main.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'c/main.cpp') diff --git a/c/main.cpp b/c/main.cpp index 673affe..7fef22e 100644 --- a/c/main.cpp +++ b/c/main.cpp @@ -406,16 +406,13 @@ void WndProcMainMenu(const HWND hWnd, unsigned short wCommand) /* Process context menu commands. */ void WndProcContextMenu(const HWND, unsigned short wCommand) { - LVITEM lvi; int cNotFound = 0; /* Look through selected items, applying the * selected command to each one. */ - lvi.mask = LVIF_PARAM; - lvi.iItem = -1; - while ((lvi.iItem = ListView_GetNextItem(g_pElv->hWnd, lvi.iItem, LVNI_SELECTED)) != -1 - && ListView_GetItem(g_pElv->hWnd, &lvi)) { + LVITEM lvi = {LVIF_PARAM, -1}; + while (g_pElv->FindNextItem(&lvi, LVNI_SELECTED)) { /* Process rate commands. */ if (ID_SUBGROUP(wCommand) == IDG_CTX_RATE) { -- cgit v1.2.3