Click here to Skip to main content
15,887,379 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Best way to handle errors (esp. in games) Pin
Aescleal18-May-12 22:39
Aescleal18-May-12 22:39 
GeneralRe: Best way to handle errors (esp. in games) Pin
forkbomber18-May-12 23:34
forkbomber18-May-12 23:34 
AnswerRe: Best way to handle errors (esp. in games) Pin
Stefan_Lang22-May-12 0:12
Stefan_Lang22-May-12 0:12 
QuestionUnable to write into Shared memory Pin
manoharbalu18-May-12 1:26
manoharbalu18-May-12 1:26 
AnswerRe: Unable to write into Shared memory Pin
TomasRiker218-May-12 2:27
TomasRiker218-May-12 2:27 
GeneralRe: Unable to write into Shared memory Pin
zhaolei.cpp@gmail.com18-May-12 3:53
zhaolei.cpp@gmail.com18-May-12 3:53 
GeneralRe: Unable to write into Shared memory Pin
zhaolei.cpp@gmail.com18-May-12 4:05
zhaolei.cpp@gmail.com18-May-12 4:05 
QuestionGetItemDataPtr (ComboBox) Not Working For Me Pin
AmbiguousName18-May-12 1:13
AmbiguousName18-May-12 1:13 
hello guys... I am trying to get and set the data in the combo box using GetItemDataPtr and SetItemDataPtr. I am facing problem when I use the function GetItemDataPtr . It return bad pointer. Here is what I do to add string
C++
int iPosition = 0;
CString sName;
sName = "Ali";

for (int nIndex = 0; nIndex < 5; nIndex++)
{
	iPosition = m_ComboNames->AddString(sName);
	ASSERT (iPosition != CB_ERR);
	ComboNames->SetItemDataPtr(iPosition, (void*)sName);
}

and to get the data from the combo box I do as under.
C++
int index = m_Combo->GetCurSel();

CString str;
LPVOID ptr;

if(index != LB_ERR)
{
	ptr = m_Combo->GetItemDataPtr(index);
	str = (CString)ptr;
	MessageBox(str );
}


As stated ealier, it shows very strange characters. How can I cast my ptr properly in order to get the value right? thnx for any input.

This world is going to explode due to international politics, SOON.

AnswerRe: GetItemDataPtr (ComboBox) Not Working For Me Pin
TomasRiker218-May-12 2:29
TomasRiker218-May-12 2:29 
GeneralRe: GetItemDataPtr (ComboBox) Not Working For Me Pin
zhaolei.cpp@gmail.com18-May-12 4:09
zhaolei.cpp@gmail.com18-May-12 4:09 
QuestionRe: GetItemDataPtr (ComboBox) Not Working For Me Pin
David Crow18-May-12 2:35
David Crow18-May-12 2:35 
AnswerRe: GetItemDataPtr (ComboBox) Not Working For Me Pin
AmbiguousName18-May-12 3:42
AmbiguousName18-May-12 3:42 
AnswerRe: GetItemDataPtr (ComboBox) Not Working For Me Pin
David Crow18-May-12 4:59
David Crow18-May-12 4:59 
AnswerRe: GetItemDataPtr (ComboBox) Not Working For Me Pin
Luc Pattyn18-May-12 5:24
sitebuilderLuc Pattyn18-May-12 5:24 
QuestionReference a struct member variable Pin
manoharbalu17-May-12 0:47
manoharbalu17-May-12 0:47 
AnswerRe: Reference a struct member variable Pin
Chris Losinger17-May-12 1:33
professionalChris Losinger17-May-12 1:33 
AnswerRe: Reference a struct member variable Pin
CPallini17-May-12 1:49
mveCPallini17-May-12 1:49 
AnswerRe: Reference a struct member variable Pin
Richard MacCutchan17-May-12 2:54
mveRichard MacCutchan17-May-12 2:54 
GeneralRe: Reference a struct member variable Pin
manoharbalu17-May-12 4:40
manoharbalu17-May-12 4:40 
GeneralRe: Reference a struct member variable Pin
Albert Holguin17-May-12 8:02
professionalAlbert Holguin17-May-12 8:02 
GeneralRe: Reference a struct member variable Pin
Erudite_Eric17-May-12 19:36
Erudite_Eric17-May-12 19:36 
AnswerRe: Reference a struct member variable Pin
Aescleal17-May-12 4:19
Aescleal17-May-12 4:19 
AnswerRe: Reference a struct member variable Pin
TomasRiker217-May-12 7:36
TomasRiker217-May-12 7:36 
AnswerRe: Reference a struct member variable Pin
Erudite_Eric17-May-12 19:38
Erudite_Eric17-May-12 19:38 
GeneralRe: Reference a struct member variable Pin
Aescleal17-May-12 21:10
Aescleal17-May-12 21:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.