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