Example of sending text messages and making phone calls by smartphone 5.0 (www.joymo.cn)

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.