Re: Problem including <AygShell.h>

I thought that I'd post the answer that I've just found out.....

When you include MFC it includes a header file "wce.h". This rather
unkindly defines a number of things including:

#define _SHLOBJ_H_
#define __urlmon_h__

These #defines normally prevent you from including the header files
shlobj.h and urlmon.h more than once. Because wce.h has defined them
already, then it prevents shlobj.h from being included at all, so when
aygshell.h tries to include it, it doesn't !!!! (Unfortunately my test
code to see if ahlobj.h was included was looking to see if _SHLOBJ_H_
was defined.)

I think this problem will only occur with MFC.

In the end, I've added the following to stdafx.h for the application:

#undef _SHLOBJ_H_
#undef __urlmon_h__
#include <aygshell.h>
#define __urlmon_h__

All is now cool !!!!!


Steve Maillet (eMVP) wrote:

The compiler has an option to generate the preprocessor output to let you
see the code as the compiler really sees it. (I think is /E or /P) that
could help isolate any preprocessor things which are conditionally
excluding that interface declaration)

Steve Maillet
smaillet at EmbeddedFusion dot com


Relevant Pages

  • Re: If (global header files are bad) then ??
    ... the wrong header file is read in the wrong context. ... The next solution to this is to give the client a single header file and a .lib file which ... statically-linked MFC libraries vs. the shared MFC DLL library. ... Note however that all of these have one common theme: a single .h file as the interface ...
  • Re: how to use static lib file in mfc application
    ... library to my mfc application. ... gives an error "fatal error no such file exist"....error is correct since i ... The header file is the "interface" of your ... features are required in your MFC project (you may also #include the ...
  • Re: How to determine if compiling a Win32 versus MFC project?
    ... MFC is selected in the wizard the way it adds WIN32, ... Are you referring to what stdafx.h accomplishes for MFC projects, a common ... header file for all my projects source files to use named ...
  • Error C2059 in MsHTML.h moving from VC6 to VS.NET 7.1
    ... I'm trying to compile our MFC application in VS.NET 7.1 after having ... the MsHTML.h header file has a "syntax error: ... Any insight is greatly appreciated. ...
  • Re: Further Attempts
    ... I did include the MFC DLL's in my image. ... "Steve Maillet " wrote: ... Did you build from eVC ... > smaillet at EmbeddedFusion dot com ...