convertToCLSID function Null safety com
- String strCLSID
Converts a Dart string into an CLSID using the CLSIDFromString call.
Returns a Pointer to the allocated CLSID. It is the caller's responsibility to deallocate the pointer when they are finished with it.
Implementation
Pointer<GUID> convertToCLSID(String strCLSID) {
final lpszCLSID = strCLSID.toNativeUtf16();
final clsid = calloc<GUID>();
try {
final hr = CLSIDFromString(lpszCLSID, clsid);
if (FAILED(hr)) {
throw WindowsException(hr);
}
return clsid;
} finally {
calloc.free(lpszCLSID);
}
}