2011-03-28 28 views
0

下面的代碼退出時,沒有例外完成之前:的Windows 7移動寬帶API - 崩潰也不例外

private void Form1_Load(object sender, EventArgs e) 
    { 
     MbnConnectionManager connectionManager = new MbnConnectionManager(); 
     IMbnConnectionManager connectionManagerInterface = (IMbnConnectionManager)connectionManager; 
     IMbnConnection[] connections = (IMbnConnection[])connectionManagerInterface.GetConnections(); 


     (IMbnConnectionProfileManager)connectionProfile; 
     MbnApi.MbnInterfaceManager interfaceManager = new MbnInterfaceManager(); 
     MbnApi.IMbnInterfaceManager interfaceManagerInterface = (IMbnInterfaceManager)interfaceManager; 

     IMbnInterface[] interfaces = interfaceManagerInterface.GetInterfaces() as IMbnInterface[]; 

     foreach (IMbnInterface mbnInterface in interfaces) 
     { 
      MBN_PROVIDER homeProvider = mbnInterface.GetHomeProvider(out homeProvider); 
     } 

    } 

此行似乎是導致飛機失事的原因 -

MBN_PROVIDER homeProvider = mbnInterface.GetHomeProvider(out homeProvider); 

爲什麼會這樣是否有任何方法可以查看Mobile Broadband API內真正發生的事情?

回答

2

您是否在系統中註冊過寬帶設備?

  1. 打開網絡和共享中心,看看是否有移動寬帶連接設備。
  2. 嘗試運行以下命令:netsh mbn show interfaces
+0

我不再有機會與我在測試該設備,但我會檢查我是否有任何其他設備使用該API。對於搜索此信息的任何人,似乎華爲設備*不會*使用此API。感謝您的回答 - 無論如何都有額外的信息。 – 2011-12-27 10:59:54

+0

netsh> mbn show interfaces 沒有移動寬帶接口 – 2011-12-27 11:16:08

+0

它取決於設備驅動程序設備是否使用MBN API。這是由設備提供商(電信公司)指定的,該設備提供商獲得定製驅動程序,而不是製造商。 – 2013-08-27 08:45:55