MainForm.cs
上传用户:linger1010
上传日期:2008-12-08
资源大小:561k
文件大小:1k
- using System;
- 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 SendingSms
- {
- public partial class MainForm : Form
- {
- OutlookSession m_outlookSession;
- public MainForm()
- {
- InitializeComponent();
- m_outlookSession = new OutlookSession();
- }
- private void m_btnSend_Click(object sender, EventArgs e)
- {
- try
- {
- // 构造短信息对象
- SmsMessage msg = new SmsMessage(
- m_txtReceiver.Text,
- m_txtMesage.Text);
- // 使用OutlookSession中的SMS帐户进行发送
- m_outlookSession.SmsAccount.Send(msg);
- // 向用户提示发送成功的信息
- MessageBox.Show(
- "Your message has been sent.",
- "Send",
- MessageBoxButtons.OK,
- MessageBoxIcon.Asterisk,
- MessageBoxDefaultButton.Button1);
- // 清空两个文本框,以备填写下一条消息
- m_txtReceiver.Text = String.Empty;
- m_txtMesage.Text = String.Empty;
- }
- catch (Exception ex)
- {
- MessageBox.Show(
- String.Format("Error: {0}", ex.Message),
- "Send",
- MessageBoxButtons.OK,
- MessageBoxIcon.Hand,
- MessageBoxDefaultButton.Button1);
- }
- }
- }
- }