Can't see items in the listview

After creating the list view.. items are there i can select them but they have transparent brush or something like that.. and I only see a selection of that item but the item itself isn't there..
Anyone knows why.. ?
Last edited on
More details are needed. Please provide code.
Ouch.. my code has like 16.000+ lines :\
I have like 8 hours I look around this code can't figure out why my text doesn't show up..
Maybe I can show you the function the header and the window class I use in my project.

this is the header "resources.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// constants
#define ID_LISTVIEW         1000
#define NUM_ITEMS           30
#define NUM_COLUMNS         2
#define MAX_ITEMLEN         64
#define MAX_SYMBOLS         16
#define MAX_DESCRIPTION     64

// stringtable defines
#define IDS_SYMBOLS         1
#define IDS_DESCRIPTION     2

//Functions from resources.cpp
HWND CreateListView(HWND hWndParent);
LRESULT NotifyHandler(HWND, UINT, WPARAM, LPARAM);

// structures
typedef struct tagABRINFO
{
    char szSymbol[MAX_SYMBOLS];
    char szDescription[MAX_DESCRIPTION];
} ABRINFO;


This is the main.cpp
ListView
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
#define _WIN32_IE 0x300

#include <windows.h>
#include <commctrl.h>
#include "resources.h"
#include <string.h>
#include <mmsystem.h>
#include <cstdio>

#define case ID_ABBREV 50

ABRINFO argsAbrInfo[] =
{
	{"LoD", "Lord of Destruction"},
	{"PvP", "Player versus Player"},
	{"XP", "Experience"},
	{"Javazon", "Javelin build Amazon"},
	{"HOTO", "Hart of the Oak Runeword"},
	{"Assa", "Assassin Character"},
	{"Andy", "Final Boss Act 1 Andariel"},
	{"D2", "Diablo 2 Classic"},
	{"PVM", "Player versus Monsters"},
	{"HP/MP", "Healing Potion/Mana Potion"}
};
HWND CreateListView(HWND hWndParent)
{
	HWND hWndList;
	int index;
	LV_COLUMN lvC;
	char szText[MAX_PATH];
	LV_ITEM lvI;
	int iSubItem;

	InitCommonControls();

	hWndList = CreateWindowEx(0L, WC_LISTVIEW, NULL, WS_VISIBLE | WS_CHILD | WS_BORDER |
                           LVS_REPORT | LVS_SINGLESEL, 0, 32, 795, 448,
                            hWndParent, (HMENU)ID_LISTVIEW, hInst, NULL);

    ListView_SetExtendedListViewStyle(hWndList, LVS_EX_FULLROWSELECT | LVM_ENSUREVISIBLE | LVM_SETOUTLINECOLOR);

	if (hWndList == NULL)
		return NULL;

	lvC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
	lvC.fmt = LVCFMT_LEFT;
	lvC.cx = 0x100;
	lvC.pszText = szText;

	for (index = 0; index <= NUM_COLUMNS; index++)
	{
		lvC.iSubItem = index;
		LoadString(hInst, IDS_SYMBOLS + index, szText, sizeof(szText));
		if (ListView_InsertColumn(hWndList, index, &lvC) == -1)
			return NULL;
	}

	lvI.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE;
	lvI.state = 0;
	lvI.stateMask = 0;

	for (index = 0; index < NUM_ITEMS; index++)
	{
		lvI.iItem = index;
		lvI.iSubItem = 0;
		lvI.pszText = LPSTR_TEXTCALLBACK;
		lvI.cchTextMax = MAX_ITEMLEN;
		lvI.lParam = (LPARAM)&argsAbrInfo[index];

		if (ListView_InsertItem(hWndList, &lvI) == -1)
			return NULL;

		for (iSubItem = 1; iSubItem < NUM_COLUMNS; iSubItem++)
		{
			ListView_SetItemText(hWndList, index, iSubItem, LPSTR_TEXTCALLBACK);
		}
	}
	return (hWndList);
}
LRESULT NotifyHandler(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	LV_DISPINFO *pLvdi = (LV_DISPINFO *)lParam;
	ABRINFO *pAbr = (ABRINFO *)(pLvdi->item.lParam);

	if (wParam != ID_LISTVIEW)
		return 0L;

	switch(pLvdi->hdr.code)
	{
		case LVN_GETDISPINFO:
			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;
}
//Main Vindow
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR args, int nCmdShow)
{
    InitCommonControls();

    WNDCLASSW wc = {0};

    wc.hbrBackground = (HBRUSH)COLOR_WINDOW;
    wc.hIcon         = (HICON)LoadImage(GetModuleHandle(NULL),
                        MAKEINTRESOURCE(IDI_MAIN), IMAGE_ICON, 32, 32, 0);
    wc.hInstance     = hInst;
    wc.lpfnWndProc   = MainWndProc;
    wc.lpszClassName = L"myMainClass";
    wc.style         = 0;
    wc.lpszMenuName  = MAKEINTRESOURCEW(IDR_MENU);

    if(!RegisterClassW(&wc))
        return -1;

    registerCloseClass(hInst);
    registerVersionClass(hInst);

    hMainWindow = CreateWindowW(L"myMainClass", L"My app",
                                WS_SYSMENU | WS_MINIMIZEBOX | WS_CAPTION,
                                300, 100, 800, 550, NULL, NULL, NULL, NULL);

    ShowWindow(hMainWindow, nCmdShow);
    UpdateWindow(hMainWindow);

    MSG msg = {0};

    while(GetMessage(&msg, NULL, 0, 0) > 0)
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }
    return 0;
}
//Main Loop
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));
            break;
        }
      case WM_COMMAND:
        switch(wp)
        {
           case ID_ABBREV:
                 {
                      hWndListView = CreateListView(hWnd);
                      PlaySound(MAKEINTRESOURCE(IDW_CLICK), NULL, SND_RESOURCE | SND_ASYNC);
                      return DefWindowProcW(hWnd, msg, wp, lp);
                  }
        }
      case WM_DESTROY:
        {
            PostQuitMessage(0);
        }
        break;
    default:
        return DefWindowProcW(hWnd, msg, wp, lp);
    }
    return 0;
}

Don't know what else to provide..?
Last edited on
Please help.. my hair begins to paint white already.. :|
My resource.rc part for this code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
.
.
./////////////////////////////////////////////////////////////////////////////
//
// String Table
//

STRINGTABLE DISCARDABLE
BEGIN
    IDS_SYMBOLS             "Symbols"
    IDS_DESCRIPTION         "Description"
END
.
.
.
Topic archived. No new replies allowed.