Answered by:
PS_USERSTYLE does not work in Release mode

Question
-
hi all, i am just learning ownDraw ComboBox. i try to draw line in ComboBox with PS_USERSTYLE. it work in Debug mode but it does not work in Release mode. please some one tell me how to fix this problem. i am using VC6 in WinXp.
NewPen.CreatePen( PS_GEOMETRIC | PS_USERSTYLE, 1, &lBrush, StyleLength, pStyle ); oPen = pDC->SelectObject( &NewPen ); pDC->MoveTo (pt1); pDC->LineTo (pt2); pDC->SelectObject (oPen); NewPen.DeleteObject (); Brush.DeleteObject ();
Thanks in Advance.
Amrit
Sunday, August 5, 2012 9:50 AM
Answers
-
well, em.... i have check as you said but i just looking for if debug work they why not release.
"Common Problems When Creating a Release Build"
http://msdn.microsoft.com/en-us/library/dykf6bx9.aspxOne thing to check - ensure you enable all the run-time error checking
options in the compiler for your debug build - that may identify
something.if any thing has problem or not initialized then it supposed not to work in view also.
Not necessarily - random memory layout can be different in
debug/release builds, and the debug version may appear to consistently
work correctly even though it's strictly wrong.i have try with new create project also in combo it does not work.
If you have a simple project that reproduces the discrepancy between
debug & release builds, please post it on a skydrive location so that
someone can pick it up and try it.Dave
- Marked as answer by Amrit.shr Monday, August 6, 2012 2:46 PM
Monday, August 6, 2012 9:02 AM
All replies
-
>hi all, i am just learning ownDraw ComboBox. i try to draw line in ComboBox with PS_USERSTYLE. it work in Debug mode but it does not work in Release mode. please some one tell me how to fix this problem. i am using VC6 in WinXp.
There's nothing obvious that I can see that would indicate anything
that might be different between your debug & release builds.Try debugging your release build to identify what's different with
your debug version.Dave
Sunday, August 5, 2012 11:44 AM -
i don't understand "Try debugging your release build to identify what's different with
your debug version."if i may understand -> if i debug in release mode it will come in ASM code. is not it? so how to check where the problem is?
Sunday, August 5, 2012 12:15 PM -
>if i may understand -> if i debug in release mode it will come in ASM code. is not it?
Not necessarily. You can compile your release build with debug
information and step through it in the debugger similar to how you do
in a debug build.See "Debugging a Release Build"
http://msdn.microsoft.com/en-us/library/fsk896zz(v=vs.71).aspxHowever, because the code is optimised you my find that as you step
through, the current line isn't what you think it should be, and local
variables may not show the current value (as they may be optimised
into registers). It's not as straightforward, but it is doable.Dave
Sunday, August 5, 2012 1:04 PM -
hi Dave,
Thanks for Good Info. Today i learn one new thing that we can debug in Release mode also. thanks for that.
Well i don't know i found problem or not. in both case i am looking for solution. but what i found in my code i have comment below.
NewPen.CreatePen( PS_GEOMETRIC | PS_USERSTYLE, 1, &lBrush, StyleLength, pStyle );
// pDC->MoveTo (pt1); // it draw solid line here with out selecting brush. // pDC->LineTo (pt2); // these 2 line work but it draw solid line
// but after select NewPen it does not work. i don't know why. i have check with another test also. the result is same
oPen = pDC->SelectObject( &NewPen ); /// no work from here. pDC->MoveTo (pt1); pDC->LineTo (pt2); pDC->SelectObject (oPen); NewPen.DeleteObject (); Brush.DeleteObject ();
Thanks
Amrit
Sunday, August 5, 2012 1:56 PM -
NewPen.CreatePen( PS_GEOMETRIC | PS_USERSTYLE, 1, &lBrush, StyleLength, pStyle );// pDC->MoveTo (pt1); // it draw solid line here with out selecting brush. // pDC->LineTo (pt2); // these 2 line work but it draw solid line // but after select NewPen it does not work.
Which would imply that perhaps there's something inconsistent in the
LOGBRUSH structure or the style array between your debug and the
release builds.Is something in that data uninitialised perhaps?
Dave
- Proposed as answer by Renjith V Ramachandran Sunday, August 5, 2012 5:16 PM
- Unproposed as answer by Amrit.shr Monday, August 6, 2012 12:57 AM
Sunday, August 5, 2012 4:13 PM -
HI Dave,
well, em.... i have check as you said but i just looking for if debug work they why not release.
and i have check with View also it work fine in Release and Debug. but it is not work with combo.
if any thing has problem or not initialized then it supposed not to work in view also.
i have try with new create project also in combo it does not work.
Monday, August 6, 2012 12:54 AM -
oops i click on unprocessed answer . sorry.Monday, August 6, 2012 12:59 AM
-
well, em.... i have check as you said but i just looking for if debug work they why not release.
"Common Problems When Creating a Release Build"
http://msdn.microsoft.com/en-us/library/dykf6bx9.aspxOne thing to check - ensure you enable all the run-time error checking
options in the compiler for your debug build - that may identify
something.if any thing has problem or not initialized then it supposed not to work in view also.
Not necessarily - random memory layout can be different in
debug/release builds, and the debug version may appear to consistently
work correctly even though it's strictly wrong.i have try with new create project also in combo it does not work.
If you have a simple project that reproduces the discrepancy between
debug & release builds, please post it on a skydrive location so that
someone can pick it up and try it.Dave
- Marked as answer by Amrit.shr Monday, August 6, 2012 2:46 PM
Monday, August 6, 2012 9:02 AM -
Hi Dave. i have learn one more thing about debug info and compiler option. but i am not clear. any way.
thank you a lot and a lot and lot for your reply. this time it work. i check setting and change few thing.
what i did here
in Project Setting -> c/c++ tab-> i Set Warning Level 4 and in Optimization i Set Default. previous it was Maximum Speed.
and Compile with Release now it Draw.
and why it just work just changing Optimization Setting? a bit curious. what is difference on those settings?
and which is good? it has few other setting and just want to know which is good for distribute EXE file.
i have check both compile exe file the compile with Max Speed is small than compile with Default.
request to make me clear on this.
Thank you a lot. once again.
Amrit
Monday, August 6, 2012 2:46 PM -
in Project Setting -> c/c++ tab-> i Set Warning Level 4 and in Optimization i Set Default. previous it was Maximum Speed.
and Compile with Release now it Draw.
and why it just work just changing Optimization Setting? a bit curious. what is difference on those settings?I'm not sure what the default setting is - possibly optimisation
disabled - which is what a debug build has.and which is good?
A good choice for a release build is "minimize size" - on the basis
that small code can often be more efficient than larger (max speed)
code.Dave
Monday, August 6, 2012 3:06 PM