IDeviceEmulatorManagerVMID::get_VMID

更新:2007 年 11 月

获取唯一标识仿真程序的虚拟机标识符 (VMID)。

HRESULT get_VMID([out, retval] BSTR* pVMID);

参数

  • [out,retval] pVMID
    一个指针,它指向包含仿真程序 VMID 的字符串。

返回值

一个指示方法调用结果的 HRESULT 值。

示例

本示例演示如何使用此方法。有关完整的示例,请参见IDeviceEmulatorManagerVMID

// For every emulator in the list
for (; SUCCEEDED(hr); (hr = pDeviceEnumerator->MoveNext()))
{
    CComBSTR deviceName;
    CComPtr<IDeviceEmulatorManagerVMID> pDevice;

    // Get the IDeviceEmulatorManagerVMID object.
    hr = pDeviceEnumerator->GetVMID(&pDevice);
    if (FAILED(hr)) {
        continue;
    }

    // Get the name of the emulator
    hr = pDevice->get_Name(&deviceName);
    if (FAILED(hr)){
        continue;
    }

    // If the name of the device matches the supplied name, 
    // then this is the device we are looking for. 
    if (deviceIdentifier == deviceName){
        *pDeviceVMID = pDevice;
        (*pDeviceVMID)->AddRef();
        return TRUE;
    }
}

要求

DEMComInterface.tlb