Pelles C forum

C language => Windows questions => Topic started by: ElectroDoc on April 10, 2011, 11:15:03 AM

Title: Common Item Dialog (Win Vista & 7)
Post by: ElectroDoc 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 (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.
Title: Re: Common Item Dialog (Win Vista & 7)
Post by: JohnF 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
Title: Re: Common Item Dialog (Win Vista & 7)
Post by: ElectroDoc on April 10, 2011, 08:12:10 PM
QuoteHad 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)