[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目录下,程序干脆就启动不起来了,请大神指点。