473,322 Members | 1,232 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

List Control, ImageList

I am using MFC in Visual Studio 2005.

I had added a list control in my dialog and set the view property as "Icon". I declared the ImageList in the OnInitDialog of the dialog where the listview is displayed. The dialog is supposed to open when I clicked a button from the main dialog. However, I keep on getting this problem which I guess is due to the hWnd = 0x00000000.

m_ListView {CListCtrl hWnd=0x00000000} CListCtrl


Part of my code:

BOOL CSoccerControl::OnInitDialog()
{
CDialog::OnInitDialog();
.
.
.
m_pImageList = new CImageList(); //I had declared m_pImageList in the header file using CImageList *m_pImageList;

//Create, initialize, and hook up image list
m_pImageList->Create(32,32,TRUE,1,1);
m_pImageList->Add(AfxGetApp()->LoadIconA(IDI_TEST));
this->m_ListView.SetImageList(m_pImageList, LVSIL_NORMAL);

return TRUE;
}

Compiler shows problem occurs here:

{ ASSERT(::IsWindow(m_hWnd)); return CImageList::FromHandle((HIMAGELIST)
::SendMessage(m_hWnd, LVM_SETIMAGELIST, nImageList, (LPARAM)pImageList->GetSafeHandle())); }


From the call stack:

mfc80d.dll!CListCtrl::SetImageList(CImageList * pImageList=0x0035b250, int nImageList=0) Line 138 + 0x2b bytes C++
Humanoid_GUI.exe!CSoccerControl::OnInitDialog() Line 136 C++
mfc80d.dll!AfxDlgProc(HWND__ * hWnd=0x000e0218, unsigned int message=272, unsigned int __formal=786840, unsigned int __formal=786840) Line 28 + 0x10 bytes C++
user32.dll!7e418734()
[Frames below may be incorrect and/or missing, no symbols loaded for user32.dll]
user32.dll!7e423b9c()
user32.dll!7e423591()
user32.dll!7e43e53f()
user32.dll!7e4184fc()
user32.dll!7e4185a4()
user32.dll!7e43e561()
user32.dll!7e418734()
user32.dll!7e43e53f()
user32.dll!7e43e53f()
user32.dll!7e418816()
user32.dll!7e43e53f()
user32.dll!7e43e53f()
ntdll.dll!7c912c99()
user32.dll!7e41c63f()
user32.dll!7e43e53f()
user32.dll!7e41f65d()
user32.dll!7e43e53f()
mfc80d.dll!CWnd::DefWindowProcA(unsigned int nMsg=272, unsigned int wParam=786840, long lParam=0) Line 1029 + 0x20 bytes C++
mfc80d.dll!CWnd::Default() Line 274 C++
mfc80d.dll!CDialog::HandleInitDialog(unsigned int __formal=786840, unsigned int __formal=786840) Line 633 + 0x8 bytes C++
mfc80d.dll!CWnd::OnWndMsg(unsigned int message=272, unsigned int wParam=786840, long lParam=0, long * pResult=0x0012f070) Line 2004 + 0x11 bytes C++
mfc80d.dll!CWnd::WindowProc(unsigned int message=272, unsigned int wParam=786840, long lParam=0) Line 1741 + 0x20 bytes C++
mfc80d.dll!AfxCallWndProc(CWnd * pWnd=0x0035a910, HWND__ * hWnd=0x000e0218, unsigned int nMsg=272, unsigned int wParam=786840, long lParam=0) Line 240 + 0x1c bytes C++
mfc80d.dll!AfxWndProc(HWND__ * hWnd=0x000e0218, unsigned int nMsg=272, unsigned int wParam=786840, long lParam=0) Line 389 C++
mfc80d.dll!AfxWndProcBase(HWND__ * hWnd=0x000e0218, unsigned int nMsg=272, unsigned int wParam=786840, long lParam=0) Line 407 + 0x15 bytes C++
user32.dll!7e418734()
user32.dll!7e418816()
user32.dll!7e41b89b()
user32.dll!7e4243e0()
user32.dll!7e424704()
user32.dll!7e439b0b()
mfc80d.dll!CWnd::CreateDlgIndirect(const DLGTEMPLATE * lpDialogTemplate=0x00a6a160, CWnd * pParentWnd=0x0012fe3c, HINSTANCE__ * hInst=0x00400000) Line 307 + 0x2a bytes C++
mfc80d.dll!CDialog::DoModal() Line 536 + 0x20 bytes C++
Humanoid_GUI.exe!CHumanoid_GUIDlg::OnBnClickedButt onSoccer() Line 264 + 0x12 bytes C++
mfc80d.dll!_AfxDispatchCmdMsg(CCmdTarget * pTarget=0x0012fe3c, unsigned int nID=1006, int nCode=0, void (void)* pfn=0x00425541, void * pExtra=0x00000000, unsigned int nSig=56, AFX_CMDHANDLERINFO * pHandlerInfo=0x00000000) Line 82 C++
mfc80d.dll!CCmdTarget::OnCmdMsg(unsigned int nID=1006, int nCode=0, void * pExtra=0x00000000, AFX_CMDHANDLERINFO * pHandlerInfo=0x00000000) Line 381 + 0x27 bytes C++
mfc80d.dll!CDialog::OnCmdMsg(unsigned int nID=1006, int nCode=0, void * pExtra=0x00000000, AFX_CMDHANDLERINFO * pHandlerInfo=0x00000000) Line 85 + 0x18 bytes C++
mfc80d.dll!CWnd::OnCommand(unsigned int wParam=1006, long lParam=1048948) Line 2300 C++
mfc80d.dll!CWnd::OnWndMsg(unsigned int message=273, unsigned int wParam=1006, long lParam=1048948, long * pResult=0x0012f800) Line 1755 + 0x1e bytes C++
mfc80d.dll!CWnd::WindowProc(unsigned int message=273, unsigned int wParam=1006, long lParam=1048948) Line 1741 + 0x20 bytes C++
mfc80d.dll!AfxCallWndProc(CWnd * pWnd=0x0012fe3c, HWND__ * hWnd=0x000e020e, unsigned int nMsg=273, unsigned int wParam=1006, long lParam=1048948) Line 240 + 0x1c bytes C++
mfc80d.dll!AfxWndProc(HWND__ * hWnd=0x000e020e, unsigned int nMsg=273, unsigned int wParam=1006, long lParam=1048948) Line 389 C++
mfc80d.dll!AfxWndProcBase(HWND__ * hWnd=0x000e020e, unsigned int nMsg=273, unsigned int wParam=1006, long lParam=1048948) Line 407 + 0x15 bytes C++
user32.dll!7e418734()
user32.dll!7e418816()
user32.dll!7e41b4c0()
user32.dll!7e41b89b()
user32.dll!7e41b903()
user32.dll!7e44fd1d()
user32.dll!7e446561()
user32.dll!7e426df4()
mfc80d.dll!AfxGetThread() Line 137 + 0x5 bytes C++
mfc80d.dll!CWinThread::ProcessMessageFilter(int code=0, tagMSG * lpMsg=0x0003001d) Line 850 + 0x5 bytes C++
00000202()
user32.dll!7e43affe()
user32.dll!7e418734()
user32.dll!7e43affe()
user32.dll!7e43affe()
user32.dll!7e418816()
user32.dll!7e43affe()
user32.dll!7e41f805()
user32.dll!7e4189cd()
user32.dll!7e43affe()
user32.dll!7e431b3c()
user32.dll!7e418a10()
user32.dll!7e42d99d()
user32.dll!7e43c69b()
mfc80d.dll!CWnd::IsDialogMessageA(tagMSG * lpMsg=0x00154198) Line 198 C++
mfc80d.dll!CWnd::PreTranslateInput(tagMSG * lpMsg=0x00154198) Line 4268 C++
mfc80d.dll!CDialog::PreTranslateMessage(tagMSG * pMsg=0x00154198) Line 80 C++
mfc80d.dll!CWnd::WalkPreTranslateTree(HWND__ * hWndStop=0x000e020e, tagMSG * pMsg=0x00154198) Line 2882 + 0x14 bytes C++
mfc80d.dll!AfxInternalPreTranslateMessage(tagMSG * pMsg=0x00154198) Line 233 + 0x12 bytes C++
mfc80d.dll!CWinThread::PreTranslateMessage(tagMSG * pMsg=0x00154198) Line 773 + 0x9 bytes C++
mfc80d.dll!AfxPreTranslateMessage(tagMSG * pMsg=0x00154198) Line 252 + 0x11 bytes C++
mfc80d.dll!AfxInternalPumpMessage() Line 178 + 0x18 bytes C++
mfc80d.dll!CWinThread::PumpMessage() Line 896 C++
mfc80d.dll!AfxPumpMessage() Line 190 + 0xd bytes C++
mfc80d.dll!CWnd::RunModalLoop(unsigned long dwFlags=4) Line 4322 + 0x5 bytes C++
mfc80d.dll!CDialog::DoModal() Line 544 + 0xc bytes C++
Humanoid_GUI.exe!CHumanoid_GUIApp::InitInstance() Line 58 + 0xb bytes C++
mfc80d.dll!AfxWinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x00151f3f, int nCmdShow=1) Line 37 + 0xd bytes C++
Humanoid_GUI.exe!WinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x00151f3f, int nCmdShow=1) Line 29 C++
Humanoid_GUI.exe!__tmainCRTStartup() Line 578 + 0x35 bytes C
Humanoid_GUI.exe!WinMainCRTStartup() Line 403 C
kernel32.dll!7c816fd7()

What should I do to avoid the problem?
Dec 17 '07 #1
0 1744

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Curtis Wellborn | last post by:
Hey, I was wondering if there is any way in the designer to put my Icons(which i have 200 in three different folders) into an ImageList with out doing it one by one in the add image. This will...
1
by: Visual Systems AB \(Martin Arvidsson\) | last post by:
Hi! Can any one point me in direction of modify a TextBox control. What i want to do is to add a button, like the ComboBox have. with my own bitmap and execute an Event when clicked. I...
1
by: Webster | last post by:
Hello, I created a User Control consisting of a TreeView and an ImageList. I've populated the ImageList with pictures (design-time using the Properties Window), and I've added some Nodes to the...
3
by: Bernie Yaeger | last post by:
I'm trying to add different images to the nodes and subnodes of a tree list. I would like the primary nodes to display one image and the secondary nodes several different images, and then, of...
7
by: Jm | last post by:
Hi All Is there a way to have multiple list views created during program runtime in code, which can have objects added, removed and later on the listview itself be removed, whilst keeping the...
0
by: Brian Henry | last post by:
Here is another virtual mode example for the .NET 2.0 framework while working with the list view. Since you can not access the items collection of the list view you need to do sorting another...
6
by: eso40043 | last post by:
Hello, I am a newbie at python, as will shortly become painfully apparent. I wrote some code that goes through a list of file names that contain names of stars. I put the star names in...
0
by: Ryan Liu | last post by:
Hi, I have this inconsistent problem for days and really get me exhausted. I have a user control with a datagrid, a small toolbar, a label and a text box on it. Toolbar has buttons to...
0
by: Phil Stanton | last post by:
I am using an imageList control for a tree menu. Works fine Problem I have is using VB to populate the ImageList Basically I have a table of Icons that I wish to use. They point to a folder...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.