c++winapicomclsidiid

Calling COM objects


I'm still learning about using COM objects. I'm trying to figure out where the values of CLSID_FileOpenDialog and IID_IFileOpenDialog are defined: https://learn.microsoft.com/en-us/windows/win32/learnwin32/example--the-open-dialog-box I couldn't find them in the included header files.

From one example I saw, I figured that I'd need .c and .h files with the interface and class GUIDs, but I couldn't find any reference of them for online.


Solution

  • They are declared as extern variables in ShObjIdl_core.h, which is included by ShObjIdl.h, which the example you linked to is including.

    The actual values are defined in uuid.lib, which your project needs to link to, otherwise you will get linker errors when it can't resolve the variables.