Solved

I'm not getting back what I stored with CB_SETITEMDATA

Posted on 2006-11-16
2
480 Views
Last Modified: 2008-01-09
I'm storing SID in the combox Item Data area for each of the item.  It's showing correctly when I debug this and check the content of the test,
groupSid = {"S-1-5-21-1993962763-879983540-725345543-1630" (1)}
groupSid = {"S-1-5-21-1993962763-879983540-725345543-1635" (1)}
But when I use  CB_GETITEMDATA to get data I get someting like: lResult = 38448552

Can someone tell me how to resolve this problem?  Thanks.


const char* test = groupSid.operator const char *();
lResult = SendMessage(hwndPrimGroup, CB_SETITEMDATA,(WPARAM)(comboSize-1), (LPARAM)(test));


lResult = SendMessage(hwndPrimGroup, CB_GETITEMDATA ,(WPARAM)index, (LPARAM)0);
0
Comment
Question by:lapucca
  • 2
2 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 17962233
The lResult value is a pointer to the item data, so you'd use

char* pszData = (char*) SendMessage(hwndPrimGroup, CB_GETITEMDATA ,(WPARAM)index, (LPARAM)0);

MessageBox(NULL,pszData,"Test",MB_OK);

to get the result.
0
 
LVL 86

Expert Comment

by:jkr
ID: 17966624
Oh, and don't forget to test for a NULL pointer before using it.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now