deepthought42
Programmer
HI all hope someone can help.
My problem is that when I try using a 'LIST CONTROL' I keep getting a access violation when running the debugger.
The actual error message is:
First-chance exception in Sunday24MarProp.exe (KERNEL32.DLL): 0xC0000005: Access Violation.
The coding I am using is shown below.
Any suggestions gratefully received
Regards Dene
// your code/pre-formatted item here
HICON hIcon[8];
int n;
m_imageList.Create(16, 16, 0, 8, 8);
hIcon[0] = AfxGetApp()->LoadIcon(IDI_ICON1);
hIcon[1] = AfxGetApp()->LoadIcon(IDI_ICON2);
hIcon[2] = AfxGetApp()->LoadIcon(IDI_ICON3);
hIcon[3] = AfxGetApp()->LoadIcon(IDI_ICON4);
hIcon[4] = AfxGetApp()->LoadIcon(IDI_ICON5);
hIcon[5] = AfxGetApp()->LoadIcon(IDI_ICON6);
hIcon[6] = AfxGetApp()->LoadIcon(IDI_ICON7);
hIcon[7] = AfxGetApp()->LoadIcon(IDI_ICON8);
for(n = 0; n < 8; n++)
{
m_imageList.Add(hIcon[n]);
}
static char* color[] = {"one", "two", "Three", "Four", "Five",
"Six", "Severn", "Eight"};
CListCtrl* pList = (CListCtrl*) GetDlgItem(IDC_LIST1);
pList->SetImageList(&m_imageList, LVSIL_SMALL);
for(n = 0; n < 8; n++)
{
pList->InsertItem(n, color[n], n);
}
pList->SetBkColor(RGB(255, 255, 0));
pList->SetTextBkColor(RGB(255, 255, 0));
My problem is that when I try using a 'LIST CONTROL' I keep getting a access violation when running the debugger.
The actual error message is:
First-chance exception in Sunday24MarProp.exe (KERNEL32.DLL): 0xC0000005: Access Violation.
The coding I am using is shown below.
Any suggestions gratefully received
Regards Dene
// your code/pre-formatted item here
HICON hIcon[8];
int n;
m_imageList.Create(16, 16, 0, 8, 8);
hIcon[0] = AfxGetApp()->LoadIcon(IDI_ICON1);
hIcon[1] = AfxGetApp()->LoadIcon(IDI_ICON2);
hIcon[2] = AfxGetApp()->LoadIcon(IDI_ICON3);
hIcon[3] = AfxGetApp()->LoadIcon(IDI_ICON4);
hIcon[4] = AfxGetApp()->LoadIcon(IDI_ICON5);
hIcon[5] = AfxGetApp()->LoadIcon(IDI_ICON6);
hIcon[6] = AfxGetApp()->LoadIcon(IDI_ICON7);
hIcon[7] = AfxGetApp()->LoadIcon(IDI_ICON8);
for(n = 0; n < 8; n++)
{
m_imageList.Add(hIcon[n]);
}
static char* color[] = {"one", "two", "Three", "Four", "Five",
"Six", "Severn", "Eight"};
CListCtrl* pList = (CListCtrl*) GetDlgItem(IDC_LIST1);
pList->SetImageList(&m_imageList, LVSIL_SMALL);
for(n = 0; n < 8; n++)
{
pList->InsertItem(n, color[n], n);
}
pList->SetBkColor(RGB(255, 255, 0));
pList->SetTextBkColor(RGB(255, 255, 0));