日期:2014-05-18 浏览次数:20780 次
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()); } } }