How do I use iFileDialog in a VC++ 2010 project converted from VC++ 6.0? How do I use iFileDialog in a VC++ 2010 project converted from VC++ 6.0? windows windows

How do I use iFileDialog in a VC++ 2010 project converted from VC++ 6.0?


The problem was that I had set a compiler flag targeting the Win XP OS. That's why a feature introduced in Vista wasn't defined.

I had _WIN32_WINNT = 0x0501 (WinXP). When I changed it to 0x0600 (Vista) the IFileDialog was defined.

Mark, your suggestion about looking into the definition of IFileDialog lead me to the cause. It led me to the ShObjIdl.h file but the section where IFileDialog was defined was greyed out, leading me up to the #if (NTDDI_VERSION >= NTDDI_VISTA) conditional.

Thanks!


My VC++ 6.0 doesn't define IFileDialog, not in the base package and not in the Windows SDK. Did you back port it from somewhere?

I would look at the definition of IFileDialog in VC++ 10. I'm guessing it's defined with the benefit of some macro, and that macro includes or excludes the _declspec(uuid('...')) depending on some compile-time constant which is set wrong.

Edit: In VC++ 10 IFileDialog is defined with the help of the MIDL_INTERFACE macro, in ShObjIdl.h. The MIDL_INTERFACE macro is defined in 3 different files, so it's hard to tell which definition you're picking up; they're all different. However I don't see any way in which the definition wouldn't be associated with a GUID.

Is it possible you're doing a forward definition of IFileDialog on your own that does not include the GUID?