BUG: GetDlgItem() Returns NULL Under Win32s

This article was previously published under Q149982
This article has been archived. It is offered "as is" and will no longer be updated.
Calling GetDlgItem() to get the CWnd pointer of a control in a dialog canfail and return NULL under Win32s. DoDataExchange(), which calls DDXfunctions, also ends up calling GetDlgItem(). This can result in an assertin Dlgdata.cpp, line 43.
This is caused by having extended styles in any of the controls in thedialog. Any extended style converts the dialog resource to a DIALOGEXresource. Win32s does not support DIALOGEX resources. None of the controlsin the dialog are be created and the dialog does not display correctly. Fordetails on how to replace the DIALOGEX style, please see the "MoreInformation" section of this article.
Remove all extended styles in all the controls in the dialog resource.
Microsoft has confirmed this to be a bug in the Microsoft products listedat the beginning of this article. We are researching the problem and willpost new information here in the Microsoft Knowledge Base as it becomesavailable.

Visual C++ versions 4.2 and later do not support building Win32sapplications.
More information
For additional information, please see the following article in theMicrosoft Knowledge Base:
138971 BUG: Default Dialog-Based Application Doesn't Work in Win32s
Dialog based hangs

Article ID: 149982 - Last Review: 10/25/2013 23:10:00 - Revision: 3.0

  • Microsoft Foundation Class Library 4.2
  • kbnosurvey kbarchive kbbug kbdlg kbprogramming kbuidesign KB149982