HRESULT ErrorCode([in] ULONGLONG err, [out,retval] USHORT* errorCode);
Get the part of the error value that represents the VIX error code. The error value returned from VIX functions contains multiple components; the least significant 16 bits are set to the error code. These error codes are described in the section on "Error Codes."
Dim job Dim err Dim readOnly ' Power on the virtual machine in headless mode. Set job = vm.PowerOn(VixCOM.Constants.VIX_POWEROP_NORMAL, Nothing, Nothing) err = job.WaitWithoutResults() If lib.ErrorCode(err) = VixCOM.Constants.VIX_E_CANNOT_START_READ_ONLY_VM Then readOnly = TRUE Else readOnly = FALSE End If