-
Controls in MFC
Hi
I have a question, I'm working on a MFC assigment and I encountered on a problem,and fixed it after spending houres searching the internet and thinking . Here is what the problem was, my project was working fine but when I would close it a run time check error ocures saying "stack around InitCtrls variable was corrupted", variable InitCtrls is defined
1. INITCOMMONCONTROLSEX InitCtrls;
2. InitCtrls.dwSize = sizeof(InitCtrls);
3. InitCtrls.dwICC = ICC_STANDARD_CLASSES;
4. InitCommonControlsEx(&InitCtrls);
Now I know that when this error ocures that there isn't enough memory for some variable
example:
int a[4];
a[5]=25; //stack over variable a corrupted
In my problem the line 3. was defined like this
InitCtrls.dwICC =ICC_WIN95_CLASSES;
and when I changed it to
InitCtrls.dwICC = ICC_STANDARD_CLASSES;
the problem was fixed. Finnaly my question is how does changing the code in line 3. relate with the simple example showed above? what do ICC_WIN95_CLASSES,ICC_STANDARD_CLASSES mean?
-
Re: Controls in MFC
No, I don't think it is not having enough stack space for some reason. You can increase your stack space in your project by changing the options.
-
Re: Controls in MFC
I suspect that it probably has to do with another stack variable either before or after "INITCOMMONCONTROLSEX InitCtrls;" which is over/under-flowing. All the ICC_xxx defines are the same size (they're #defines in commctl.h).
-
Re: Controls in MFC
[ removed duplicate thread ]
-
Re: Controls in MFC
You're right hoxsiew, I put the ICC_WIN95_CLASSES back and it works fine now, it was another variable. The problem would always occur when I would add a variable by an Add Variable Wizard in my Edit Control in the Dialog box, and when I would remove the variable, then there would be no run time errors.