__uuidof
Remonter à Liste alphabétique des mots clés - Index
Syntaxe
__uuidof(EXPR)
Description
__uuidof
récupère le GUID associé à l'expression. Exemple :
struct __declspec(uuid("{66AF87D4-0A13-49EB-B540-36A180FA53FA}")) TNode {
float relevance;
};
// ...
TGUID guid = __uuidof(TNode);
ShowMessage(GUIDToString(guid)); // displays a message box with text "{66AF87D4-0A13-49EB-B540-36A180FA53FA}"
Vous pouvez utiliser cet opérateur pour obtenir la valeur du GUID associé à une interface. C'est nécessaire lors de l'utilisation de la fonction QueryInterface. Exemple :
HRESULT hres = SpecificClassInstance->QueryInterface(__uuidof(ISpecificInterface), &specificInterfaceInstance);
if (S_OK == hres) // ...