虾米@ 2019-10-11 14:51 采纳率: 11.1%
浏览 351
已结题

asp.net用短信模块通过串口给手机发送短信

[STAThread]
[DllImport("sms.dll", EntryPoint = "Sms_Connection")]
public static extern uint Sms_Connection(string CopyRight, uint Com_Port, uint Com_BaudRate, out string Mobile_Type, out string CopyRightToCOM);

    [DllImport("sms.dll", EntryPoint = "Sms_Disconnection")]
    public static extern uint Sms_Disconnection();

    [DllImport("sms.dll", EntryPoint = "Sms_Send")]
    public static extern uint Sms_Send(string Sms_TelNum, string Sms_Text);

    [DllImport("sms.dll", EntryPoint = "Sms_Receive")]
    public static extern uint Sms_Receive(string Sms_Type, out string Sms_Text);

    [DllImport("sms.dll", EntryPoint = "Sms_Delete")]
    public static extern uint Sms_Delete(string Sms_Index);

    [DllImport("sms.dll", EntryPoint = "Sms_AutoFlag")]
    public static extern uint Sms_AutoFlag();

    [DllImport("sms.dll", EntryPoint = "Sms_NewFlag")]
    public static extern uint Sms_NewFlag();       

protected void Page_Load(object sender, EventArgs e)
{
protConnection();
}

    public void protConnection()
    {
        String TypeStr="";
        string CopyRightToCOM="";
        String CopyRightStr = "//上海迅赛信息技术有限公司,网址www.xunsai.com//";
     bool   connect = Sms_Connection(CopyRightStr, uint.Parse("3"), 9600, out TypeStr, out CopyRightToCOM) == 1;
        if (connect)
        {
            Log("串口COM3连接成功");
        }
        else
        {
            Log("串口COM3连接失败");
        }
    }


    protected void Button1_Click(object sender, EventArgs e)
    {
        string phone = this.tx2.Text; //发送短信的目标号码
        string message = this.tx1.Text; //短信内容
        Sms_Send(phone, message);
    }

            页面中就一个号码框和一个短信内容文本框,一个发送按钮,sms.dll文件以经放在了system32目录下,启动程序提示:无法加载 DLL“sms.dll”: 找不到指定的模块。
            然后又将sms.dll文件放在了项目bin目录下,以及release和debug目录下,程序干脆就启动不起来了,请大神指点。
  • 写回答

2条回答 默认 最新

  • 不喝水的鱼 2019-10-11 14:58
    关注

    你这个应该是win系统吧?看看dll是32位的还是64位,跟你当前的系统一致不?另外找不到路径好像跟环境变量有关,好像有个path里面可以设置。

    评论

报告相同问题?

悬赏问题

  • ¥15 ue5 .3之前好好的现在只要是激活关卡就会崩溃
  • ¥50 MATLAB实现圆柱体容器内球形颗粒堆积
  • ¥15 python如何将动态的多个子列表,拼接后进行集合的交集
  • ¥20 vitis-ai量化基于pytorch框架下的yolov5模型
  • ¥15 如何实现H5在QQ平台上的二次分享卡片效果?
  • ¥15 python爬取bilibili校园招聘网站
  • ¥30 求解达问题(有红包)
  • ¥15 请解包一个pak文件
  • ¥15 不同系统编译兼容问题
  • ¥100 三相直流充电模块对数字电源芯片在物理上它必须具备哪些功能和性能?