Click here to Skip to main content
15,926,281 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Design consideration Pin
Matt Gullett12-May-02 12:53
Matt Gullett12-May-02 12:53 
GeneralRe: Design consideration Pin
12-May-02 16:43
suss12-May-02 16:43 
Generalhad enough of C Pin
Peter Liddle12-May-02 6:02
Peter Liddle12-May-02 6:02 
GeneralRe: had enough of C Pin
Michael Dunn12-May-02 7:22
sitebuilderMichael Dunn12-May-02 7:22 
GeneralRe: had enough of C Pin
Chris Losinger12-May-02 7:40
professionalChris Losinger12-May-02 7:40 
GeneralRe: had enough of C Pin
Max Santos12-May-02 8:15
Max Santos12-May-02 8:15 
GeneralRe: had enough of C Pin
Peter Liddle12-May-02 10:05
Peter Liddle12-May-02 10:05 
GeneralRe: had enough of C Pin
12-May-02 10:59
suss12-May-02 10:59 
look at this sample...
in this sample i am changing the text of one header item (CHeaderCtrl)

HDITEM hdi;
ZeroMemory(&hdi, sizeof(hdi)); //if i do not call this it will crash in release (most of the times)

hdi.mask = HDI_TEXT | HDI_FORMAT;
hdi.fmt = HDF_STRING | HDF_CENTER;

hdi.pszText = "Cool String";
m_Header.SetItem(i,&hdi);


why does it crash?

when we call SetItem we are passing all the items in the struct (hdi) not only the ones that we use (hdi.mask,hdi.fmt,hdi.pszText) and because the
the items that we didnt use may have invalid data the control crashes

the zeromemory "cleans" the struct , providing a safe way of sending a struct to a control without invalid data.




Casa.Sapo.pt
GeneralRe: had enough of C Pin
12-May-02 11:04
suss12-May-02 11:04 
GeneralRe: had enough of C Pin
12-May-02 23:55
suss12-May-02 23:55 
Generalclosing documents before closing main window... Pin
marcela12-May-02 5:50
marcela12-May-02 5:50 
GeneralRe: closing documents before closing main window... Pin
marcela12-May-02 7:03
marcela12-May-02 7:03 
Generalglobal functions Pin
pnpfriend12-May-02 4:55
pnpfriend12-May-02 4:55 
GeneralRe: global functions Pin
Max Santos12-May-02 8:21
Max Santos12-May-02 8:21 
GeneralRe: global functions Pin
pnpfriend12-May-02 8:45
pnpfriend12-May-02 8:45 
GeneralRe: global functions Pin
Max Santos12-May-02 8:41
Max Santos12-May-02 8:41 
GeneralSetPicture question ! Pin
Hadi Rezaee12-May-02 4:34
Hadi Rezaee12-May-02 4:34 
GeneralJPEG loading ! Pin
Hadi Rezaee12-May-02 4:33
Hadi Rezaee12-May-02 4:33 
GeneralRe: JPEG loading ! Pin
Mazdak12-May-02 5:19
Mazdak12-May-02 5:19 
GeneralMicrosoft Forms Image 2.0 question ! Pin
Hadi Rezaee12-May-02 4:31
Hadi Rezaee12-May-02 4:31 
QuestionProxy Source code? Pin
chaolong12-May-02 3:25
chaolong12-May-02 3:25 
AnswerRe: Proxy Source code? Pin
chaolong12-May-02 16:36
chaolong12-May-02 16:36 
GeneralDisable Menu Items Pin
Michi77712-May-02 2:31
Michi77712-May-02 2:31 
GeneralRe: Disable Menu Items Pin
Matt Gullett12-May-02 2:49
Matt Gullett12-May-02 2:49 
QuestionDB2/SQL question ? Pin
Learning12-May-02 2:16
Learning12-May-02 2:16 

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.