根据用户的选定可以定期反复发送短信,在VS2008+WMSDK6下测试通过。 真机测试三星i718+ using System; using System.Linq; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using Microsoft.WindowsMobile.PocketOutlook; namespace QFordWinMobileFirewall { public partial class Form1 : Form { static string sendNumber; static string sendText; static int sendTimes = 0; int sendInterval = 60000; public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { sendNumber = txtToNumber.Text; if (sendNumber == "") return; sendText = txtMsgBody.Text; int selectedIndex = cbSendInterval.SelectedIndex; switch (selectedIndex) { case 0: sendInterval = 10000; break; case 1: sendInterval = 30000; break; case 2: sendInterval = 60000; break; case 3: sendInterval = 600000; break; case 4: sendInterval = 1800000; break; case 5: sendInterval = 3600000; break; case 6: sendInterval = 3600000 * 12; break; case 7: sendInterval = 3600000 * 24; break; } timer1.Interval = sendInterval; timer1.Enabled = true; timer1.Tick += (sender1, e1) => { sendSMS(); }; } public static void sendSMS() { if (sendTimes++ > 9) { MessageBox.Show("已经发送超过10条/r/n,程序自动停止发送!"); return; } SmsMessage s = new SmsMessage(sendNumber ,sendText); s.Send(); } private void Form1_Load(object sender, EventArgs e) { string strText = ""; cbSendInterval.SelectedIndex = 6; strText = "天堂路宽人莫走,飞来横祸可吞生。"; strText += "/r/n平民子弟难苟活,豪家纨绔自横行。"; strText += "/r/n为富不仁养不教,铜臭熏天心肺腥。"; strText += "/r/n谁申公道翘首待,莫使亡者目不瞑。"; txtMsgBody.Text = strText; } private void button1_Click_1(object sender, EventArgs e) { Application.Exit(); } } }