我已经在Windows 7中工作的下面的代码:HRESULT时没有MBN设备存在
MbnInterfaceManager mbnInfMgr = new MbnInterfaceManager();
IMbnInterfaceManager mbnInfMgrInterface = mbnInfMgr as IMbnInterfaceManager;
if (mbnInfMgrInterface != null)
{
IMbnInterface[] mobileInterfaces = mbnInfMgrInterface.GetInterfaces() as IMbnInterface[];
}
当MBN设备存在,但是当MBN设备不存在我得到的没有问题在调用GetInterfaces()后出现异常:
{System.Runtime.InteropServices.COMException(0x80070490):找不到元素。 (从HRESULT异常:0x80070490) 在MbnApi.IMbnInterfaceManager.GetInterfaces() 在foo.Program.configureConnection()在FOO}
问题 有什么应该做检查前的MBN接口调用GetInterfaces?我可以简单地捕捉到这个异常,但我找不到任何说这个异常与没有接口相同的文档。
我在statckoverflow上发现的最接近的东西是 struggling with mobile broadband api windows 7 and windows 8 with C#, not sure what to install 这意味着Windows 7的行为可能与Windows 8.1不同。
我注意到这种情况发生在某些蜂窝调制解调器硬件上,如果某些设备管理器中的“设备”被禁用。 –