Click here to Skip to main content
15,896,063 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: DrawText is giving me garbage Pin
Mark Salsbery9-Sep-08 5:30
Mark Salsbery9-Sep-08 5:30 
GeneralRe: DrawText is giving me garbage Pin
thebeekeeper9-Sep-08 5:37
thebeekeeper9-Sep-08 5:37 
GeneralRe: DrawText is giving me garbage Pin
Mark Salsbery9-Sep-08 5:45
Mark Salsbery9-Sep-08 5:45 
GeneralRe: DrawText is giving me garbage Pin
thebeekeeper9-Sep-08 6:09
thebeekeeper9-Sep-08 6:09 
GeneralRe: DrawText is giving me garbage Pin
Mark Salsbery9-Sep-08 6:22
Mark Salsbery9-Sep-08 6:22 
GeneralRe: DrawText is giving me garbage Pin
thebeekeeper9-Sep-08 6:36
thebeekeeper9-Sep-08 6:36 
GeneralRe: DrawText is giving me garbage Pin
Mark Salsbery9-Sep-08 7:09
Mark Salsbery9-Sep-08 7:09 
GeneralRe: DrawText is giving me garbage Pin
thebeekeeper9-Sep-08 6:59
thebeekeeper9-Sep-08 6:59 
AHA! I just figured out that I'm doing the conversion correctly (maybe), the problem is I have bad data to convert.

I inspected the memory location that lpDrawItemStruct->itemData was pointing to, and it looked like garbage. So, I added a method to my class where I can send text and store it in a vector. Then, in DrawItem I just look in my own vector for strings to draw, and everything works fine.

I guess this works for now, but I'd really like to know how to get my string out of itemData so I can use AddString on my list box like a normal person.

The only idea that I have right now is that my initial cast in DrawItem is bad.
LPCTSTR lpszText = (LPCTSTR) lpDrawItemStruct->itemData;

I don't see how this could be bad since that's exactly what I'm passing to AddString. The strange this is that it works when I pass in a literal with TEXT("..."), but not a converted const char* from string.c_str().

Thanks for your help!
GeneralRe: DrawText is giving me garbage Pin
Mark Salsbery9-Sep-08 7:17
Mark Salsbery9-Sep-08 7:17 
GeneralRe: DrawText is giving me garbage Pin
Mark Salsbery9-Sep-08 7:19
Mark Salsbery9-Sep-08 7:19 
GeneralRe: DrawText is giving me garbage Pin
thebeekeeper9-Sep-08 7:25
thebeekeeper9-Sep-08 7:25 
GeneralRe: DrawText is giving me garbage Pin
Mark Salsbery9-Sep-08 7:31
Mark Salsbery9-Sep-08 7:31 
QuestionRe: DrawText is giving me garbage Pin
led mike9-Sep-08 5:32
led mike9-Sep-08 5:32 
QuestionEmbedded Data Pin
claman9-Sep-08 5:05
claman9-Sep-08 5:05 
JokeRe: Embedded Data Pin
CPallini9-Sep-08 5:35
mveCPallini9-Sep-08 5:35 
JokeRe: Embedded Data Pin
toxcct9-Sep-08 5:43
toxcct9-Sep-08 5:43 
JokeRe: Embedded Data Pin
enhzflep9-Sep-08 5:47
enhzflep9-Sep-08 5:47 
JokeRe: Embedded Data Pin
Perspx9-Sep-08 6:12
Perspx9-Sep-08 6:12 
JokeRe: Embedded Data Pin
CPallini9-Sep-08 6:13
mveCPallini9-Sep-08 6:13 
GeneralRe: Embedded Data Pin
Hamid_RT9-Sep-08 8:21
Hamid_RT9-Sep-08 8:21 
QuestionRe: Embedded Data Pin
CPallini9-Sep-08 9:30
mveCPallini9-Sep-08 9:30 
AnswerRe: Embedded Data Pin
Hamid_RT9-Sep-08 20:32
Hamid_RT9-Sep-08 20:32 
GeneralRe: Embedded Data Pin
CPallini9-Sep-08 21:06
mveCPallini9-Sep-08 21:06 
GeneralRe: Embedded Data Pin
Hamid_RT10-Sep-08 0:44
Hamid_RT10-Sep-08 0:44 
GeneralRe: Embedded Data Pin
CPallini10-Sep-08 0:59
mveCPallini10-Sep-08 0:59 

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.