I have the following code working in Windows 7:
MbnInterfaceManager mbnInfMgr = new MbnInterfaceManager();
IMbnInterfaceManager mbnInfMgrInterface = mbnInfMgr as IMbnInterfaceManager;
if (mbnInfMgrInterface != null)
{
IMbnInterface[] mobileInterfaces = mbnInfMgrInterface.GetInterfaces() as IMbnInterface[];
}
No problems when the MBN device exists but when an MBN device doesn't exist I get the following exception in the call to GetInterfaces():
{System.Runtime.InteropServices.COMException (0x80070490): Element not found. (Exception from HRESULT: 0x80070490) at MbnApi.IMbnInterfaceManager.GetInterfaces() at foo.Program.configureConnection() in foo}
Question Is there something that should be done to check for a MBN interface before calling GetInterfaces? I can simply catch this exception but I can't find any documentation that says this exception is the same as having no interfaces.
The closest thing I have found on statckoverflow is this struggling with mobile broadband api windows 7 and windows 8 with C#, not sure what to install which implies that maybe windows 7 behaves differently than windows 8.1.