Click here to Skip to main content
15,885,435 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I am trying to use the IFileDialog2 object on Windows 7

#include <shobjidl.h>

...

CComPtr<IFileDialog2> FileDialog2Ptr;
HRESULT hr = FileDialog2Ptr.CoCreateInstance(__uuidof(IFileDialog2));


The result hr is "0x80040154 Class not registered".

According to MSDN[^] IFileDialog2 requires Windows 7 and ComDlg32.dll version 6.1 or later. I am running Windows 7 Home Edition with ComDlg32.dll version 6.1.7601.17514.

I am using VS2005 Team Suite SP1 with the Platform SDK version 7.0


How can I fix this error?
Posted
Updated 16-Jun-11 19:21pm
v2

1 solution

you're trying to create the interface from an invalid class factory

HRESULT hr = FileDialog2Ptr.CoCreateInstance(__uuidof(IFileDialog2));


That should be CLSID_FileOpenDialog?

Have a look here Common Item Dialog[^]
 
Share this answer
 
v2
Comments
PJ Arends 17-Jun-11 3:07am    
The link you gave talks about IFileDialog, IFileSaveDialog, and IFileOpenDialog. These were new in Vista. The MSDN link I gave above is for IFileDialog2 that is new in Win7. I got the older ones to work just fine, but I want the functionality of IFileDialog2 where I can limit the scope with SetNavigationRoot().
barneyman 17-Jun-11 4:09am    
yes it does, but I'm guessing those interfaces are exposed by that class factory ... the uuid of the interface is different from the uuid of the class factory
PJ Arends 17-Jun-11 12:17pm    
Tried it, and it works! Thanks

<pre>HRESULT hr = FileDialog2Ptr.CoCreateInstance(CLSID_FileOpenDialog);</pre>

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900