⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sendsms.cs

📁 TPO cell Project : A college TPO cell project.
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
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.IO;
/// <summary>
/// Summary description for SendSMS
/// </summary>
public class SendSMS
{
    //string driveLetter = "c:/";
    //string netPath = txtNetPath.Text;
    //string username = txtUsername.Text;
    //string password = txtPassword.Text;
	public SendSMS(string mobileno, string message)
	{
        WriteBatchFile(mobileno, message);
	}
    private void WriteBatchFile( string data, string message )
    {
        try
        {
            // Write file
            data = "smssender.exe /p:" + data + " /m:\"" + message+"\"";
            FileStream fileStream = new FileStream( "c:\\temp.bat", System.IO.FileMode.Create, System.IO.FileAccess.Write );
            StreamWriter writer = new StreamWriter( fileStream );
            writer.WriteLine("set path=%path%;C:\\Program Files\\Microsoft SMS Sender\\;");
            writer.WriteLine(data);
            writer.Close();
            fileStream.Close();

            // Run process
            System.Diagnostics.Process proc = new System.Diagnostics.Process();
            proc.EnableRaisingEvents=false;
            proc.StartInfo.FileName="c:\\temp.bat";
            proc.Start();
            proc.WaitForExit();
            // Delete file
            //File.Delete( "c:\\temp.bat" );
        }
        catch( Exception ex )
        {
            throw ex;
            //lblStatus.Text = ex.Message;
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -