日期:2014-05-18  浏览次数:20780 次

企业信息机,短信平台二次开发
在做一个华为的企业信息机,短信服务商提供了个 接口 SMEntry.dll,已将它放至bin文件夹下
以下为代码,运行到int count = SP_Startup("61.142.175.86,1393", "test", "test");
报错 “无法加载 DLL“SMEntry.dll”: 找不到指定的模块。 (异常来自 HRESULT:0x8007007E)。”

这个问题应该怎么解决
C# code
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Runtime.InteropServices;

public partial class _Default : System.Web.UI.Page 
{
   

    //注意应用dll库都需要进行函数初始化,然后才能再进行引用,每个函数需要实例化一遍,不管是否在同一个dll库中。
    [DllImport("SMEntry.dll")]
    public static extern int SubmitShortMessage(string AtTime, string SourceAddr, string DestAddr, string Content, int ContentLen, int NeedStateReport, string ServiceID, string FeeType, string FeeCode);
    [DllImport("SMEntry.dll")]
    public static extern int SP_Startup(string DBName, string Account, string Password);
    [DllImport("SMEntry.dll")]
    public static extern void SP_Cleanup();


    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void SendMS_Click(object sender, EventArgs e)
    {
        Start();
        Message_Send("13715361043", "赵经理,能收到消息吗,如果收到,就测试成功了!");
        Clear();

    }
    private void Message_Send(string Phone, String StrText)
    {
        int count = SubmitShortMessage("2008-2-25 09:23:43", "1065730799365", Phone, StrText, 50, 1, "EIES", "01", "1");
        if (count != 0)
        {
            Response.Write("88888");
            Response.Write("11" + count.ToString());
        }
        else
            Response.Write("发送成功");
    }

    private void Clear()
    {
        SP_Cleanup();
    }
    private void Start()
    {
        int count = SP_Startup("61.142.175.86,1393", "test", "test");
        if (count != 0)
        {
            Response.Write("99999");
            Response.Write("22" + count.ToString());
        }
    }

}



------解决方案--------------------
将SMEntry.dll拷贝到当前目录或\windows\system32目录下