Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 944511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:36:16+00:00 2026-05-15T22:36:16+00:00

I’m using a virtual lit control and I get the data from a map.

  • 0

I’m using a virtual lit control and I get the data from a map. My problem is when I run the code, it displays the list ok, but when the mouse cursor moves on to the list control or when I try to scroll down, it gives a Debug Assertion failure saying map/set iterator is not dereferencable. My GetDispInfo() method is as follows:

void CListCtrlTestDlg::GetDispInfo(NMHDR* pNMHDR, LRESULT* pResult) 
{
   LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
   LV_ITEM* pItem = &(pDispInfo)->item;

   map<int, Error_Struct>::iterator it  = Error_Map.find((pItem->iItem) + 1);
   int iErrCode = (*it).second.i_ErrorCode;
   CString cError = (*it).second.c_Error;


    switch(pItem->iSubItem)
    {
    case 0:
        sprintf_s(pItem->pszText, 10, "[ %d ]", iErrCode);
        break;
    case 1:
        sprintf_s(pItem->pszText, 100, "%s", cError);
        break;
    }


*pResult = 0;

}

Also if when the mouse pointer is on top of the list control, again the program crashes saying access violation from the line showed below in output.c file:

#else  /* _UNICODE */
   if (_putc_nolock(ch, f) == EOF)

Has anyone got the same experience? What am I doing wrong here and how can I fix this problem?

Thank You!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T22:36:17+00:00Added an answer on May 15, 2026 at 10:36 pm

    The actual problem was that I was trying copy data to a non-buffer member of LV_ITEM structure. I was trying to copy data to a mere pointer, that was the problem. What I should have really done was to assign a value to that pointer without copying data.

    p = o_RBTree.FindByPosition((pItem->iItem) + 1);
    
    char zKey[10];
    zKey[0] = '\0';
    sprintf_s(zKey, 10, "%d", p.first);
    
    char zVal[100];
    zVal[0] = '\0';
    sprintf_s(zVal, 100, "%d", p.second);
    
    if (pItem->mask && LVIF_TEXT) 
    {
        switch(pItem->iSubItem)
        {
        case 0:
            pItem->pszText = zKey;
            break;
        case 1:
            pItem->pszText = zVal;
            break;
        }
    }
    

    This works perfectly! Thanks for the help.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently running into a problem where an element is coming back from
I want to construct a data frame in an Rcpp function, but when I
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.