getCount method
Retrieves a count of the devices in the device collection.
Throws a WindowsException on failure.
To learn more, see learn.microsoft.com/windows/win32/api/mmdeviceapi/nf-mmdeviceapi-immdevicecollection-getcount.
Implementation
int getCount() {
final pcDevices = adaptiveCalloc<Uint32>();
final hr$ = HRESULT(_GetCountFn(ptr, pcDevices));
if (hr$.isError) {
free(pcDevices);
throw WindowsException(hr$);
}
final result$ = pcDevices.value;
free(pcDevices);
return result$;
}