【问题标题】:How to send and receive SMS programmatically in Windows 10 using MBN?如何使用 MBN 在 Windows 10 中以编程方式发送和接收 SMS?
【发布时间】:2015-08-05 15:49:16
【问题描述】:

我们有一个程序可以通过 MBN IMbnSms 接口和 2G/3G/4G 调制解调器发送和接收 SMS 消息。我们的代码在 Windows 7 和 Windows 8.x 中工作,但在 Windows 10 中失败。 IMbnSms.GetSmsStatus() 始终返回 0x8000000A (E_PENDING) 错误,即使调制解调器已在网络上驻留 10 分钟。 IMbnSms.SmsSendPdu() 在 OnSmsSendComplete 事件中获取 E_MBN_FAILURE。

下面是重现此问题的 GetSmsStatus() 的简单测试代码:

    using MbnApi;
    using System;

    namespace GetSmsStatusTest
    {
        class Program
        {
            static void Main(string[] args)
            {
                GetSmsStatus(args[0]);
            }

            static void GetSmsStatus(string interfaceID)
            {
                try
                {
                    MbnInterfaceManager mbnInfMgr = new MbnInterfaceManager();
                    IMbnInterfaceManager infManager = (IMbnInterfaceManager)mbnInfMgr;

                    //obtain the IMbnInterface passing interfaceID
                    IMbnInterface mbnInterface = infManager.GetInterface(interfaceID);
                    IMbnSms mbnSms = mbnInterface as IMbnSms;
                    if (mbnSms == null)
                    {
                        Console.WriteLine("Got no IMbnSms");
                        return;
                    }
                    MBN_SMS_STATUS_INFO mbnSmsStatusInfo;
                    mbnSms.GetSmsStatus(out mbnSmsStatusInfo);
                    Console.WriteLine("flag={0}, index={1}", mbnSmsStatusInfo.flag, mbnSmsStatusInfo.messageIndex);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                }   
            }
    }

使用可以通过“netsh mbn sho int”获得的网络接口 GUID 调用它。

【问题讨论】:

    标签: sms windows-10 mobile-broadband-api


    【解决方案1】:

    微软用我 7 日拿到的 Windows 10 更新包解决了这个问题。我用几张数据卡重新测试过,现在可以了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-11-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-10-16
      • 1970-01-01
      相关资源
      最近更新 更多