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 8978375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:35:49+00:00 2026-06-15T19:35:49+00:00

I have a CListCtrl and I want to store a UINT32 value, but it

  • 0

I have a CListCtrl and I want to store a UINT32 value, but it always returns 0 when I read with GetItemData

I have this code:

UINT CMyDialog::MyThread(LPVOID pArg)
  for (int nItem=0; nItem<50; nItem++)
  {
    UINT32 nNum=100;
    pDlg->m_listCtrl.InsertItem(0, _T("text")); // this works
    pDlg->m_listCtrl.SetItemData(nItem, nNum); // this not
   }
 }

/// this is called from a Dialog member function when a button is pressed

void CMyDialog::OnBtnClicked()
{
  UINT32 nRead=0;
  nRead=m_listCtrl.GetItemData(5);

  // nRead always returns 0
 }

Even if I use int or DWORD instead of UINT I get the same result.

  • 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-06-15T19:35:50+00:00Added an answer on June 15, 2026 at 7:35 pm

    Please be more careful posting your code. It’s so simple to use cut and paste that there is no excuse for making error after error. It’s very hard to help you and hardly worth it since you don’t accept many answers.

    At any rate, I do see a problem with your loop. You should be using the return value from InsertItem() like this:

    UINT CMyDialog::MyThread(LPVOID pArg)
    {
        for (int nItem=0; nItem<50; nItem++)
        {
            UINT32 nNum=100;
            int nIndex = pDlg->m_listCtrl.InsertItem(0, _T("text"));
            pDlg->m_listCtrl.SetItemData(nIndex, nNum);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a CListCtrl with checkboxes. I want to be able to disable one
Have written all the code in a silverlight class library (dll) and linked this
Have converted devise new session from erb to Haml but doens't work, this is
Have a look at this code: #include <iostream> using namespace std; int main() {
I have the following code in a CDialog. This code works perfectly on Windows
I want to have CListCtrl.EditLabel() for any column of the list. How can I
I have a CListCtrl with plenty of room for all of the items, and
I have a CListCtrl control that has 2 columns and any number of rows.
in my application I have a few CListCtrl tables. I fill/refresh them with data
I have an owner-drawn list control in my Windows program. I use CListCtrl::GetBkColor to

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.