Microsoft KB Archive/232982

= BUG: IsDialogMessage Stops Passing Messages to DlgProc =

PSS ID Number: 232982

Article Last Modified on 11/18/2003

-

The information in this article applies to:


 * Microsoft Windows CE Platform Builder 2.11
 * Microsoft Windows CE Embedded Toolkit for Visual C++ 5.0
 * Microsoft Windows CE 2.10 Enhancement Pack for Windows CE Embedded Toolkit for Visual C++ 5.0

-



This article was previously published under Q232982



SYMPTOMS
A dialog box created using a custom window class with CreateDialogIndirect may stop responding to system messages. The IsDialogMessage function will return TRUE, but the window message will not be sent to the DlgProc for the dialog. The dialog box will appear hung and will not respond to user input.



CAUSE
The value normally used for the cbWndExtra field for a dialog box WNDCLASS structure is the (?DIALOGEXTRA?). The Windows CE header file defines this value as 32, but the size of the structure used by Windows CE is padded to a total of 36 bytes. The 4 bytes beyond the reserved space are subject to damage by subsequent memory allocations.

One of the values in the exposed 4-byte area is a flag that indicates the dialog is being terminated. When this flag is set, no window messages are sent to the DlgProc function. Under normal operation, this flag is set as a part of EndDialog processing. If set at any other time, the dialog box becomes orphaned.



RESOLUTION
In place of using the defined (?DIALOGEXTRA?) value, use the cbWndExtra value found in the WNDCLASS structure of the default dialog windows class. WNDCLASS WndClassTemp; int cbDlgExtra;

GetClassInfo(NULL, TEXT("Dialog"), &WndClassTemp); cbDlgExtra = WndClassTemp.cbWndExtra; This value always reflects the true size of the structure used by the version of the operating system the application is running on.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



MORE INFORMATION
The cbWndExtra field of the WNDCLASS structure is used to define a block of memory used by the Windows CE Window Manager to hold an internal structure. The contents of this structure is not documented and not useful to the application. However, the application is responsible for defining the amount of space to reserve.

Keywords: kbbug KB232982

Technology: kbAudDeveloper kbSDKSearch kbWinCEEnh210ETKVC500 kbWinCEETKSearch kbWinCEETKVC500 kbWinCESDK211 kbWinCESDKSearch kbWinCESearch

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© 2004 Microsoft Corporation. All rights reserved.