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. forms; // Add reference Microsoft. windowsmobile. Forms. dll
Using Microsoft. windowsmobile. pocketoutlook; // Add a reference to Microsoft. windowsmobile. pocketoutlook. dll.
Using Microsoft. windowsmobile. telephony; // Add a reference to Microsoft. windowsmobile. telephony. dll.
// Www.joymo.cn Tumo Wireless Development Network
Namespace smsphone
{
Public partial class mainfrm: Form
{
Private smessage SMS = new smsmessage (); // SMS class in Microsoft. windowsmobile. pocketoutlook namespace,
Private phone = new phone (); // phone class in Microsoft. windowsmobile. telephony namespace
Private choosecontactdialog dialog = new choosecontactdialog (); // contact us in the Microsoft. windowsmobile. Forms namespace
Public mainfrm ()
{
Initializecomponent ();
}
Private void addlinkman_menuitem_click (Object sender, eventargs E)
{
If (dialog. showdialog () = dialogresult. OK)
{
Phonenumber_textbox.text = dialog. selectedcontact. mobiletelephonenumber; // send the contact mobile number to the phonenumber file box.
}
}
Private void sms_menuitem_click (Object sender, eventargs E)
{
SMS. Body = message_textbox.text; // Add the text message
SMS. to. Add (new recipient (phonenumber_textbox.text); // specify the number to be sent
SMS. requestdeliveryreport = false; // No delivery notification is sent after the message is sent successfully.
Try
{
SMS. Send ();
}
Catch (exception ERR)
{
MessageBox. Show (ERR. message, "error", messageboxbuttons. okcancel, messageboxicon. Hand, messageboxdefaultbutton. button1 );
Return;
}
MessageBox. Show ("message sent successfully", "succeeded", messageboxbuttons. OK, messageboxicon. None, messageboxdefaultbutton. button1 );
}
Private void phone_menuitem_click (Object sender, eventargs E)
{
Try
{
Phone. Talk (phonenumber_textbox.text); // call a specified phone number.
}
Catch (exception ERR)
{
MessageBox. Show (ERR. message, "error", messageboxbuttons. okcancel, messageboxicon. Hand, messageboxdefaultbutton. button1 );
Return;
}
}
Private void menuitem1_click (Object sender, eventargs E)
{
This. Close ();
}
}
}
Source codeFor download, see http: // 218.249.175.5: 8008/download/showinfo. asp? Id = 4324