|Posted by Vermi||PermalinkReply|
Summary: scope(exit) Problem
--- Comment #0 from Vermi <firstname.lastname@example.org> 2009-10-26 04:00:32 PDT ---
I don't know if it's really a dmd bug or it's a windows bug, because I made several tests and I don't really understand where is the error. Here is the code : (Working with earlier version of dmd (2.022 if I remember well) :
protected bool _onPaint(PAINTSTRUCT paintStr)
int oldMode = SetBkMode(paintStr.hdc, TRANSPARENT);
MessageBoxA(null, "tic", "tic", MB_OK);
// Some code
If the function return without exception, the code in the scope statement is properly executed and functionnal, the Background Mode for the DC is restored to OPAQUE (it's original value).
If an exception is thrown ( with the code : (cast(Object)null).toString() for
example ), The MessageBox show, but the background mode the DC is not restored,
and the background simply disapear in the window.
I made some tests on the return value of SetBkMode :
If an exception is thrown, SetBkMode return OPAQUE (wich is strange, it should return TRANSPARENT according to msdn).
If no exception is thrown, SetBkMode return 0, wich is strange too, because 0 means error. I don't know what to think.
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------