發送短信我有這樣的代碼:C#從計算機
private SerialPort port = new SerialPort("COM1", 115200, Parity.None, 8, StopBits.One);
Console.WriteLine("Incoming Data:");
port.WriteTimeout = 5000;
port.ReadTimeout = 5000;
// Attach a method to be called when there is data waiting in the port's buffer
port.DataReceived += new SerialDataReceivedEventHandler(port_DataReceived);
// Begin communications
port.Open();
#region PhoneSMSSetup
port.Write("AT+CMGF=1\r\n");
Thread.Sleep(500);
port.Write("AT+CNMI=2,2\r\n");
Thread.Sleep(500);
port.Write("AT+CSCA=\"+4790002100\"\r\n");
Thread.Sleep(500);
#endregion
// Enter an application loop which keeps this thread alive
Application.Run();
我從這裏得到它:
http://www.experts-exchange.com/Programming/Languages/C_Sharp/Q_22832563.html
我有一個新的WinForms空的應用程序:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
你能告訴我:
- 我究竟在哪裏粘貼代碼?
- 我如何獲得運行代碼?
我發送AT命令,我的手機是連接到計算機
按鈕怎麼樣? – kenny 2010-06-12 01:58:54