Dialog boxes (About Boxes and otherwise) no longer appear -- in
applications where there was previously no problem. This problem only
occurs after recent Updates have been installed. Also, it only occurs
on XP, and where there is a manifest for comctrl32.dll version 6.
Whatever the problem may be, it can be resolved by including a call to
InitCommonControls[Ex] somewhere in the application's initialization
-- even if that would not otherwise be needed. (However, that does not
do much good for what is already out there.)
This is probably related to what was discussed in the thread "EDIT
controls now require InitCommonControls?" However, the behavior I
experienced was a little strange.
Calls to DialogBox (or any of the related procedures) return -1 -- an
error. However, an immediately following call to GetLastError returns
0 -- no error.
If one puts breakpoints on the DialogProcedure, it is seen that
WM_INITDIALOG is never sent to it. The first message it receives is
WM_SETFONT. However, the sequence of messages which usually follows,
ending with WM_INITDIALOG, does not happen. Instead it next receives
WM_DESTROY, and that is the end of the dialog box.
So it is not only a matter of controls not being shown. Nothing is
shown.
It probably wouldn't hurt to start putting in a call to
InitCommonControls[Ex], regardless of the need for it. Still, with all
the existing code that is probably now broken (including a few of the
SDK samples), Microsoft will probably come up with some kind of fix.
Thanks and good luck,
Bill
This is standard. Within the dialog editor, if you click on properties you
will see under "Misc" that one of the fields is "No fail create". Setting
this rather poorly worded option to False (the default) means that the
dialog won't show if any of its controls fails to be created. Set it to True
and you will get the dialog minus any failing control.
> It probably wouldn't hurt to start putting in a call to
> InitCommonControls[Ex], regardless of the need for it. Still, with all
> the existing code that is probably now broken (including a few of the
> SDK samples), Microsoft will probably come up with some kind of fix.
Microsoft has been advising people using Visual Themes to call
InitCommonControls from the start. Many have been ignoring the advice
however. See the advice from MSDN given below:
//////////////////////////////////////////////////////////////////////////////////////
To create a manifest and enable your application to use visual styles.
1. Link to ComCtl32.lib and call InitCommonControls.
2. Add a file called YourApp.exe.manifest to your source tree that has the
XML manifest format.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="X86"
name="CompanyName.ProductName.YourApplication"
type="win32"
/>
<description>Your application description here.</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
3. Add the manifest to your application's resource file as follows:
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "YourApp.exe.manifest"
////////////////////////////////////////////////////////////////////////////////////
http://msdn.microsoft.com/library/en-us/shellcc/platform/commctls/userex/cookbook.asp?frame=true
If I look at the last version of the MSDN library that works with VC++ 6.0,
namely October 2001, I find the same advice.
The documentation is not fully consistent, however (big surprise, eh). If we
look at the documentation for InitCommonControlsEx, then we read
"Windows XP: If a manifest is used, InitCommonControlsEx is not required."
--
John Carson