CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • Installing SQL Server 2008
  • Writing UDFs for Firebird Embedded SQL Server
  • [Updated] Shutdown Manager
  • Building Windows Azure Cloud Service Applications with Azure Storage and the Azure SDK

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > Managed C++ and C++/CLI
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    Managed C++ and C++/CLI Discuss Managed C++ and .NET-specific questions related to C++.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1    
    Old July 25th, 2005, 12:12 PM
    BrucePataki BrucePataki is offline
    Junior Member
     
    Join Date: Jul 2005
    Posts: 9
    BrucePataki is an unknown quantity at this point (<10)
    Exclamation Debug assertion failed

    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
    Reply With Quote
      #2    
    Old July 25th, 2005, 12:21 PM
    MrViggy's Avatar
    MrViggy MrViggy is offline
    Elite Member
     
    Join Date: Feb 2002
    Posts: 3,775
    MrViggy has much to be proud of (1500+)MrViggy has much to be proud of (1500+)MrViggy has much to be proud of (1500+)MrViggy has much to be proud of (1500+)MrViggy has much to be proud of (1500+)MrViggy has much to be proud of (1500+)MrViggy has much to be proud of (1500+)MrViggy has much to be proud of (1500+)MrViggy has much to be proud of (1500+)MrViggy has much to be proud of (1500+)MrViggy has much to be proud of (1500+)
    Re: Debug assertion failed

    Has the list control been created yet? Can you post the whole function that contains the call to "GetDlgItem"?

    Viggy
    Reply With Quote
      #3    
    Old July 25th, 2005, 01:00 PM
    BrucePataki BrucePataki is offline
    Junior Member
     
    Join Date: Jul 2005
    Posts: 9
    BrucePataki is an unknown quantity at this point (<10)
    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);
    }
    Reply With Quote
      #4    
    Old July 25th, 2005, 04:12 PM
    MrViggy's Avatar
    MrViggy MrViggy is offline
    Elite Member
     
    Join Date: Feb 2002
    Posts: 3,775
    MrViggy has much to be proud of (1500+)MrViggy has much to be proud of (1500+)MrViggy has much to be proud of (1500+)MrViggy has much to be proud of (1500+)MrViggy has much to be proud of (1500+)MrViggy has much to be proud of (1500+)MrViggy has much to be proud of (1500+)MrViggy has much to be proud of (1500+)MrViggy has much to be proud of (1500+)MrViggy has much to be proud of (1500+)MrViggy has much to be proud of (1500+)
    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.
    Reply With Quote
    Reply

    Bookmarks
    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > Managed C++ and C++/CLI


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 06:45 PM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
    Copyright WebMediaBrands Inc. 2002-2009