NO

Author Topic: Common Item Dialog (Win Vista & 7)  (Read 3711 times)

ElectroDoc

  • Guest
Common Item Dialog (Win Vista & 7)
« on: April 10, 2011, 11:15:03 AM »
I'm trying to use Common Item Dialog on Windows 7 using PellesC 6.5 RC3.
The code can be found in: http://msdn.microsoft.com/en-us/library/bb776913(v=vs.85).aspx
("Basic Usage" paragraph)

(Source code is attached)

When compiled, it gives me this error:
Type error in argument 1 to 'CoCreateInstance'; expected 'LPCGUID const' but found 'GUID'.

There is some other errors regarding accessing the class methods, I think I can fix them. But now I'm concerned about this error only.

Any help will be really appreciated.

JohnF

  • Guest
Re: Common Item Dialog (Win Vista & 7)
« Reply #1 on: April 10, 2011, 02:11:57 PM »
Try the attached - I don't have vista so can't test.

Had to add uuid.lib and ole32.lib to the build.

John

ElectroDoc

  • Guest
Re: Common Item Dialog (Win Vista & 7)
« Reply #2 on: April 10, 2011, 08:12:10 PM »
Quote
Had to add uuid.lib and ole32.lib to the build

You're right, but still there is something missing.

A call to CoInitializeEx() must be done before calling CoCreateInstance(). After I added that, it worked perfectly.

So, you put me in the right direction.
Thank you very much, John.

(The final working project is attached)