Article ID: 196342 - Last Review: June 18, 2001 - Revision: 1.0 PRB: ActiveDesktop Compilation Errors Under Visual C++ 6.0 MFC
This article was previously published under Q196342 SYMPTOMS
Under Visual C++ 6.0 Microsoft Foundation Classes (MFC), compiling code
related to the IActiveDesktop interface will fail with multiple errors,
including an "undeclared identifier" for LPACTIVEDESKTOP.
Note that this occurs specifically when compiling an MFC program using Visual C++ 6.0. There is no report of the problem occurring in previous versions of MFC or in the general Visual C++ 6.0 case where C or C++ programs are being compiled. CAUSE
When an MFC application includes the Stdafx.h header file, the file
*\Vc98\Mfc\Include\Afxdisp.h is included by default. Within Afxdisp.h the
file Shlobj.h (required for ActiveDesktop) is included. But at this point,
Wininet.h has not been included, so certain portions of Shlobj.h are not
correctly initialized for ActiveDesktop support.
The inclusion of Shlobj.h by Afxdisp.h also sets a variable preventing Shlobj.h from being included twice. Later, when an MFC application explicitly and correctly includes Wininet.h followed by Shlobj.h, the previously set variable prevents the second Shlobj.h inclusion and also prevents critical ActiveDesktop definitions, such as for LPACTIVEDESKTOP, from being made. RESOLUTION
Add a #include for the Wininet.h header to the Stdafx.h precompiled header
file, just above the Afxdisp.h include. Here's an example of Stdafx.h:
| Other Resources Other Support Sites
CommunityGet Help NowArticle Translations
|





















Back to the top