FIX: CheckAutoCenter May Return TRUE with DS_ABSALIGNLast reviewed: September 18, 1997Article ID: Q132116 |
The information in this article applies to:
SYMPTOMSPositioning a dialog box, using DS_ABSALIGN and the Y axis screen coordinate of zero causes the dialog box to be centered within the application's main window.
CAUSEThe function Dialog::CheckAutoCenter() is called to determine whether the dialog should be centered. In the case of y == 0, CheckAutoCenter() will always return TRUE. This happens because of the following code from CheckAutoCenter() in WINCORE.CPP:
BOOL bResult = !(lpTemplate->style & DS_ABSALIGN) && lpTemplate->x == 0 || lpTemplate->y == 0;Note that because of the way C/C++ handles logical expressions, if lpTemplate->style == DS_ABSALIGN, then lpTemplate->x == 0 will not be evaluated. However, lpTemplate->y == 0 is evaluated and therefore is capable of returning TRUE to CheckAutoCenter().
RESOLUTIONDo not use a Y coordinate of zero with DS_ABSALIGN.
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem has been fixed in Visual C++ 5.0 for Windows.
MORE INFORMATIONTo reproduce this problem set the DS_ABSALIGN style and a y position of zero for the about box of a standard Appwizard-generated application.
|
Additional query words: center
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |