fix: include <objbase.h> before <exdisp.h> for MSVC

<exdisp.h> is not self-contained: its forward declarations use the
\interface\ macro, which is only defined in <combaseapi.h> via the
<objbase.h> include chain. Qt headers do not provide <windows.h>, so
including <exdisp.h> first caused C2146/C2371 parse errors on MSVC and
broke all IShellWindows usages. Include <objbase.h> as a prelude.
This commit is contained in:
yyc12345 committed 2026-10-12 16:49:56 +08:00
1 parent e7b6bdd7dd
commit 8ff33f1bbb
1 file changed
+9
+9
View File
@@ -13,6 +13,15 @@
#include <optional>
// YYC MARK:
// <exdisp.h> is not self-contained: it only includes <rpc.h>/<rpcndr.h> before
// emitting `typedef interface ...` forward declarations, while the `interface`
// macro (defined as `struct` for C++) lives in <combaseapi.h>, which is pulled
// in via the <objbase.h> chain. Without this prelude, MSVC fails to parse those
// forward declarations (C2146/C2371) and every IShellWindows usage breaks.
// (Qt headers do not include <windows.h>, so nothing else provides it here.)
#include <objbase.h>
#include <exdisp.h> // IShellWindows, CLSID_ShellWindows
#include <servprov.h> // IServiceProvider
#include <shlguid.h> // SID_STopLevelBrowser