UuidToString function
Applies to: desktop apps only
The UuidToString function converts a UUID to a string.
Syntax
RPC_STATUS RPC_ENTRY UuidToString( __in const UUID __RPC_FAR *Uuid , __out RPC_CSTR __RPC_FAR *StringUuid );
Parameters
- Uuid [in]
-
Pointer to a binary UUID.
- StringUuid [out]
-
Pointer to the null-terminated string into which the UUID specified in the Uuid parameter will be placed.
Return value
| Value | Meaning |
|---|---|
|
The call succeeded. |
|
The system is out of memory. |
Note For a list of valid error codes, see RPC Return Values.
Remarks
An application calls UuidToString to convert a binary UUID to a string UUID. The RPC run-time library allocates memory for the string returned in the StringUuid parameter. The application is responsible for calling RpcStringFree to deallocate that memory.
Requirements
|
Minimum supported client | Windows 2000 Professional |
|---|---|
|
Minimum supported server | Windows 2000 Server |
|
Header |
|
|
Library |
|
|
DLL |
|
|
Unicode and ANSI names | UuidToStringW (Unicode) and UuidToStringA (ANSI) |
See also
Send comments about this topic to Microsoft
Build date: 3/6/2012
example you asked!!
#include <iostream>
#include <windows.h>
int main( int argc, char* argv[]) {
CLSID clsAppID = { 0 };
ZeroMemory( &clsAppID, sizeof(clsAppID));
wchar_t* szGUID = 0;
if ( RPC_S_OK == UuidToString( &clsAppID, (RPC_WSTR*)&szGUID)) {
std::wcout << L"RPC_S_OK" << std::endl;
std::wcout << szGUID << std::endl;
} else {
std::wcout << L"Unknown" << std::endl;
}
return 0;
}
#include <windows.h>
int main( int argc, char* argv[]) {
CLSID clsAppID = { 0 };
ZeroMemory( &clsAppID, sizeof(clsAppID));
wchar_t* szGUID = 0;
if ( RPC_S_OK == UuidToString( &clsAppID, (RPC_WSTR*)&szGUID)) {
std::wcout << L"RPC_S_OK" << std::endl;
std::wcout << szGUID << std::endl;
} else {
std::wcout << L"Unknown" << std::endl;
}
return 0;
}
- 4/13/2012
- diesalunix
Code Sample
It would be very helpful to have a small code sample for this and all APIs
- 1/31/2012
- Martin Fallenstedt
The UUID string will contain dashes
The UUID string will contain dashes, as in the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
- 9/29/2010
- Adzm
A sample would be nice
For those of use not closely familiar with the RPC functions a quick example of how to call this function and free the string would be helpful. Mostly the double indirect pointer bits are non-obvious.
- 4/19/2010
- SimonRev
- 4/20/2010
- Thomas Lee