Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

I'm not getting back what I stored with CB_SETITEMDATA

Posted on 2006-11-16
2
Medium Priority
?
538 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 2000 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

[Webinar] Cloud Security

In this webinar you will learn:

-Why existing firewall and DMZ architectures are not suited for securing cloud applications
-How to make your enterprise “Cloud Ready”, and fix your aging DMZ architecture
-How to transform your enterprise and become a Cloud Enabler

Question has a verified solution.

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

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

963 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