From 531400b7000b268b5287532bf1c0a58412de2a27 Mon Sep 17 00:00:00 2001 From: freedom Date: Wed, 11 Oct 2023 11:03:24 -0600 Subject: [PATCH] a step closer now i just need the item.. to appear. --- progmgr/group.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/progmgr/group.c b/progmgr/group.c index 5563c66..fda6d9b 100644 --- a/progmgr/group.c +++ b/progmgr/group.c @@ -200,6 +200,7 @@ PITEM CreateItem(_In_ HWND hWndGroup, _In_ PITEM pi) PGROUP pGroup = NULL; PITEM pItem = NULL; UINT uiTest = 0; + HWND hWndListView = NULL; // we actually just want the group pointer lol pGroup = (PGROUP)GetWindowLongPtr(hWndGroup, GWLP_USERDATA); @@ -214,6 +215,11 @@ PITEM CreateItem(_In_ HWND hWndGroup, _In_ PITEM pi) if (pi == NULL) return NULL; + // get the listview window + hWndListView = FindWindowEx(hWndGroup, NULL, WC_LISTVIEW, NULL); + if (hWndListView == NULL) + return NULL; + // compare group's existing memory to needed memory // if needed, reallocate the group's memory if (_msize(pGroup) != CalculateGroupMemory(pGroup, 1)) @@ -234,13 +240,15 @@ PITEM CreateItem(_In_ HWND hWndGroup, _In_ PITEM pi) lvi.mask = LVIF_TEXT; // | LVIF_IMAGE; lvi.iItem = 0; lvi.iSubItem = 0; + lvi.state = 0; + lvi.stateMask = 0; lvi.pszText = pItem->szName; lvi.cchTextMax = ARRAYSIZE(pItem->szName); // lvi.iImage = I_IMAGECALLBACK; lvi.lParam = (LPARAM)pItem; // copy that bad boy into the listview - ListView_InsertItem(FindWindowEx(hWndGroup, NULL, TEXT("ListView"), NULL), &lvi); + ListView_InsertItem(hWndListView, &lvi); // TODO: fail if the listview item isn't added