Calling SetThemeAppProperties
with argument which has flag STAP_ALLOW_CONTROLS
unset causes CoCreateInstance
for Common Dialogs (or at list File Open Dialog, CLSID_FileOpenDialog
) to return error 0x80040111
.
Sample code is following:
HRESULT hResult;
CComPtr< IFileOpenDialog > pFileOpenInterface1;
CComPtr< IFileOpenDialog > pFileOpenInterface2;
hResult = ::CoCreateInstance( CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS( &pFileOpenInterface1 ) );
::SetThemeAppProperties( 0 );
hResult = ::CoCreateInstance( CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS( &pFileOpenInterface2 ) );
To make it into running code I have created (in Visual Studio 2010 Professional) a simple Win32 GUI application and added that code to menu Help|About handler.
Why is it so and how to work around that issue?
Disabling visual styles on all controls is a pretty heavy hammer. Not that surprising that the latest version of the dialogs don't support it. Try to fall back to the legacy shell dialog interface with GetOpenFileName(). Next remove the manifest entry that enables the 6.0 version of the common controls. A bit anathema to the idea of skinning perhaps.