Click here to Skip to main content
15,917,059 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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
GeneralRe: Tab Cntrl String issue Pin
Michael Dunn26-Feb-05 12:40
sitebuilderMichael Dunn26-Feb-05 12:40 
Generalnamespaces and libraries Pin
Anonymous26-Feb-05 2:21
Anonymous26-Feb-05 2:21 
GeneralRe: namespaces and libraries Pin
Michael Dunn26-Feb-05 4:32
sitebuilderMichael Dunn26-Feb-05 4:32 
GeneralPicture Tracking ... Not compilable to VS.NET 2005 Pin
x2bf326-Feb-05 0:28
x2bf326-Feb-05 0:28 
QuestionTo change the last-modified time of a file? Pin
Monisankar25-Feb-05 23:48
Monisankar25-Feb-05 23:48 
AnswerRe: To change the last-modified time of a file? Pin
David Crow26-Feb-05 3:23
David Crow26-Feb-05 3:23 
AnswerRe: To change the last-modified time of a file? Pin
Ravi Bhavnani26-Feb-05 4:27
professionalRavi Bhavnani26-Feb-05 4:27 
GeneralPerfect coders wanted (freelancers) Pin
PavelMenshikov25-Feb-05 23:44
PavelMenshikov25-Feb-05 23:44 
GeneralRe: Perfect coders wanted (freelancers) Pin
Ravi Bhavnani26-Feb-05 4:33
professionalRavi Bhavnani26-Feb-05 4:33 
GeneralRe: Perfect coders wanted (freelancers) Pin
alex.barylski26-Feb-05 10:24
alex.barylski26-Feb-05 10:24 
GeneralRe: Perfect coders wanted (freelancers) Pin
ThatsAlok27-Feb-05 20:17
ThatsAlok27-Feb-05 20:17 

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.