Click here to Skip to main content
15,913,854 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalcode doesn't work when compiled in debug mode Pin
lino_i26-Feb-05 12:51
lino_i26-Feb-05 12:51 
GeneralRe: code doesn't work when compiled in debug mode Pin
Rob Manderson26-Feb-05 13:21
protectorRob Manderson26-Feb-05 13:21 
GeneralRe: code doesn't work when compiled in debug mode Pin
lino_i26-Feb-05 14:18
lino_i26-Feb-05 14:18 
GeneralRe: code doesn't work when compiled in debug mode Pin
Jibesh27-Feb-05 4:51
professionalJibesh27-Feb-05 4:51 
GeneralRe: code doesn't work when compiled in debug mode Pin
lino_i27-Feb-05 5:38
lino_i27-Feb-05 5:38 
Generalvoid* to Address Conversion Pin
Daklan26-Feb-05 12:22
Daklan26-Feb-05 12:22 
GeneralRe: void* to Address Conversion Pin
Michael Dunn26-Feb-05 12:37
sitebuilderMichael Dunn26-Feb-05 12:37 
GeneralRe: void* to Address Conversion Pin
Daklan26-Feb-05 12:48
Daklan26-Feb-05 12:48 
Generalc++ basic class Pin
bigbadnewill26-Feb-05 11:44
bigbadnewill26-Feb-05 11:44 
GeneralRe: c++ basic class Pin
Daklan26-Feb-05 12:34
Daklan26-Feb-05 12:34 
GeneralRe: c++ basic class Pin
Anonymous27-Feb-05 10:20
Anonymous27-Feb-05 10:20 
GeneralChanging colours of a combo box Pin
Alton Williams26-Feb-05 10:08
Alton Williams26-Feb-05 10:08 
QuestionHow to set up dynamic context menus in MS Word Pin
Sabuncu26-Feb-05 7:12
Sabuncu26-Feb-05 7:12 
GeneralCrashes in international version Pin
JWood26-Feb-05 6:21
JWood26-Feb-05 6:21 
GeneralRe: Crashes in international version Pin
Michael Dunn26-Feb-05 6:51
sitebuilderMichael Dunn26-Feb-05 6:51 
GeneralRe: Crashes in international version Pin
JWood26-Feb-05 8:14
JWood26-Feb-05 8:14 
GeneralRe: Crashes in international version Pin
Michael Dunn26-Feb-05 9:23
sitebuilderMichael Dunn26-Feb-05 9:23 
GeneralRe: Crashes in international version Pin
JWood27-Feb-05 9:34
JWood27-Feb-05 9:34 
GeneralMinidumps! Pin
jhwurmbach27-Feb-05 1:08
jhwurmbach27-Feb-05 1:08 
GeneralRe: Minidumps! Pin
JWood27-Feb-05 9:32
JWood27-Feb-05 9:32 
GeneralRe: Minidumps! Pin
jhwurmbach27-Feb-05 21:04
jhwurmbach27-Feb-05 21:04 
GeneralTab Cntrl String issue Pin
realloc26-Feb-05 4:46
realloc26-Feb-05 4:46 
GeneralRe: Tab Cntrl String issue Pin
Ravi Bhavnani26-Feb-05 5:20
professionalRavi Bhavnani26-Feb-05 5:20 
GeneralRe: Tab Cntrl String issue Pin
Michael Dunn26-Feb-05 6:04
sitebuilderMichael Dunn26-Feb-05 6:04 
GeneralRe: Tab Cntrl String issue Pin
realloc26-Feb-05 6:47
realloc26-Feb-05 6:47 
Thanks for the replies!

As it turned out, you were on the money with the mask member. This is my first forary into tab controls, and obviously misread the MSDN docs.


Michael Dunn wrote:
4. You're storing a TCITEM struct in a list, but the TCITEM contains a pointer to a char array on the stack. As soon as that array goes out of scope, the pointer becomes invalid.

Sorry for the confusion, I should have explained the snippet more clearly to avoid leading people down the wrong track. "list" is actually a ref to a vector passed in to the function.

so, in following everyones advice, I changed the struct definition to:

TC_ITEM tab = {0};
tab.mask = TCIF_TEXT | TCIF_PARAM | TCIF_IMAGE;
tab.dwState = 0;
tab.iImage = -1;
tab.pszText = (LPSTR)r->name.c_str();
tab.lParam = (LPARAM)r;
tab.cchTextMax = r->name.size() + 1;

this solved the display poblem, so my control is fully operational now.

Thanks for all the help, this board has been great!

Dave

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.