c++windowswinapiguid

What's the C++ version of Guid.NewGuid()?


I need to create a GUID in an unmanaged windows C++ project. I'm used to C#, where I'd use Guid.NewGuid(). What's the (unmanaged windows) C++ version?


Solution

  • I think CoCreateGuid is what you're after. Example:

    GUID gidReference;
    HRESULT hCreateGuid = CoCreateGuid( &gidReference );