|
-
February 9th, 2011, 02:04 PM
#1
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?
-
February 9th, 2011, 03:56 PM
#2
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.
ahoodin
To keep the plot moving, that's why.

-
February 10th, 2011, 08:28 AM
#3
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).
-
February 10th, 2011, 08:53 AM
#4
Re: Controls in MFC
[ removed duplicate thread ]
-
February 10th, 2011, 11:56 AM
#5
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|