| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | Newsletters | VB Forums | Developer.com |
|
|||||||
| Managed C++ and C++/CLI Discuss Managed C++ and .NET-specific questions related to C++. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Running the application where we feed the data from one window and display in another window having list view control - I notice that data is correctly passed on for display in view class. However, I tried to create a list view control pointer like this:
CListCTRL* pList = (CListCTRL *) GetDlgItem (IDC_List1); which in turn gives me runtime error in winocc.cpp that debug assertion failed at line 94: Line 94 in winocc.cpp is ASSERT(::IsWindow(m_hWnd)); If anyone knows how to fix this problem or have any tips, I would surely appreciate. Bruce |
|
#2
|
||||
|
||||
|
Re: Debug assertion failed
Has the list control been created yet? Can you post the whole function that contains the call to "GetDlgItem"?
Viggy |
|
#3
|
|||
|
|||
|
Re: Debug assertion failed
yeah i have created the listview control. I tried to create the listview in the function OnInitialUpdate and it worked successfully.
My need is to keep both windows open like receiver and sender mechanism i.e. Data is passed from one form having edit control and after sending data, display them in listview in separate form. But when i tried to do the same in my defined function (in addition to OnInitialUpdate) i.e. AddData(), I face this problem. The sequence of code follows. Both Functions exist in the same cpp file. void CTestView::OnInitialUpdate() { CFormView::OnInitialUpdate(); ResizeParentToFit(); m_pSelection = NULL; // initialize selection CListCtrl* pList = (CListCtrl*) GetDlgItem(IDC_LIST1); // THIS ONE WORKS pList->InsertColumn(0,"ym",LVCFMT_CENTER,140); pList->InsertColumn(1,"Ws",LVCFMT_CENTER,70); pList->InsertColumn(2,"State",LVCFMT_CENTER,50); } void CTestView::AddData(LPCTSTR tn,LPCTSTR cn,LPCTSTR ts,LPCTSTR cv) { int i=0,j=0; int flag = 0; j=rowcount-1; //pointer to the listview control CListCtrl* pList = (CListCtrl*) GetDlgItem(IDC_LIST1); // THIS ONE DOES NOT WORK pList->InsertItem(0,ts); } |
|
#4
|
||||
|
||||
|
Re: Debug assertion failed
Hmm, that should work. Is the call to "AddData" running in the same thread as the one that "OnInitialUpdate" is running in?
Vig. |
![]() |
| Bookmarks |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|