I have 2 List view controls and I need to send the VM_NOTIFY for both of them..
The program compile and run but I see some issues if I toggle between them.
One of them shows correctly and the other shows only the first column and the second shows few words most of the rows are empty.
LRESULT NotifyHandler(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
LV_DISPINFOW *pLvdi = (LV_DISPINFOW *)lParam;
ABRINFO *pAbr = (ABRINFO *)(pLvdi->item.lParam);
if (wParam != ID_LISTVIEW)
return 0L;
switch(pLvdi->hdr.code)
{
case LVN_GETDISPINFOW:
switch (pLvdi->item.iSubItem)
{
case 0:
pLvdi->item.pszText = pAbr->szSymbol;
break;
case 1:
pLvdi->item.pszText = pAbr->szDescription;
break;
default:
break;
}
break;
default:
break;
}
return 0L;
}
This is the second one:
LRESULT NotifyHandlerXP(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
LV_DISPINFOW *pLvdi = (LV_DISPINFOW *)lParam;
XPINFO *pXP = (XPINFO *)(pLvdi->item.lParam);
if(wParam != ID_LISTVIEW)
return 0L;
switch(pLvdi->hdr.code)
{
case LVN_GETDISPINFOW:
switch(pLvdi->item.iSubItem)
{
case 0:
pLvdi->item.pszText = pXP->szCharLevel;
break;
case 1:
pLvdi->item.pszText = pXP->szXpNedded;
break;
case 2:
pLvdi->item.pszText = pXP->szXpNeddedNextLvl;
break;
default:
break;
}
default:
break;
}
return 0L;
}
How to handle in the MainWndProc?
LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
{
static HWND hWndListView;
switch(msg)
{
case WM_NOTIFY:
{
return (NotifyHandler(hWnd, msg, wp, lp));
return (NotifyHandlerXP(hWnd, msg, wp, lp));
break;
}
default:
return DefWindowProcW(hWnd, msg, wp, lp);
}
return 0;
}
What I have tried:
I only thought of an IF statement.. I'm working on it right now.
HWND CreateListView(HWND hWndParent)
hWndListView = CreateListView(hWnd);
HWND CreateListViewXP(HWND hWndParentXP)
hWndListView = CreateListViewXP(hWnd);
These are the 2 handlers for the both List View controls.