1,Call
If you want to make a call in the. NET program, you need to call the API through P/invoke.
In Versions later than Windows Mobile 5, the Microsoft. windowsmobile. telephony Class Library provides us with the call function.
Before using this function, we must add Microsoft. windowsmobile. telephony reference. The code for calling the telephone function is as follows:
Phone phone = new phone ();
Phone. Talk ("called phone number ");
There is only one talk method for the phone class, so you can only make phone calls. To implement some complex functions, such as monitoring incoming calls, we also need to call TAPI.
2,Send message
Both short messages and emails must be supported by the Microsoft. windowsmobile. pocketoutlook class library.
Pocketoutlook is a complicated namespace, including support for many system functions, while smsmessage is a class that supports text messages.
Public void smsmessagesend ()
{
Smsmessage = new smsmessage ();
Smsmessage. Body = "sent content ";
Smsmessage. to. Add (new recipient ("contact name", "contact phone number "));
Smsmessage. requestdeliveryreport = true;
Smsmessage. Send (); // send
Return;
}
The body attribute of smessage is the content of SMS messages, while the to attribute is the recipient's name and phone number,
Because multiple recipients are supported, you must call the Add method of the to attribute when adding recipients. The requestdeliveryreport attribute is a bool value and sets whether to send a report.
Finally, call the send method of smsmessage.
3,Send email
The email sending code is similar to the short message sending code, but the emailmessage class is used.
Public void emailsend ()
{
Emailmessage message = new emailmessage ();
Message. Subject = "title ";
Message. bodytext = "email content ";
Recipient client = new recipient ("name", "email address ");
Message. to. Add (client );
Attachment image = new attachment ("added attachments ");
Message. attachments. Add (image );
Message. Send ("ActiveSync ");
}
The subject attribute of emailmessage is the email title, and the bodytext attribute is the mail body. You can add the Recipient Name and Address to the to attribute. We can also add attachments in the attachments attribute.
Finally, we call the send method.
4,Contact,AppointmentAndTask
Windows Mobile has three important programs: contacts, appointments, and tasks.
We can use the Microsoft. windowsmobile. pocketoutlook class library to call contacts, appointments, and task information in the system. We can add information through our own program.
Let's take a look at an important class outlooksession in the Microsoft. windowsmobile. pocketoutlook namespace.
An object in this class represents a pocket outlook object module. Previously, we needed to call the functions implemented by poom. Now we can use pocketoutlook.
Attribute description:
Appointments obtains information about the calendar directory.
Contacts obtains the contact directory information.
Emailaccounts obtains the set of email accounts.
Smsaccount obtains the information of the SMS account.
Tasks obtains a set of task directory information.
When using outlooksession, you must first create an outlooksession object, then create the corresponding object and add it to the corresponding attributes of outlooksession.
Outlooksession session = new outlooksession ();
// Add appointment
Appointment appointment = new appointment ();
Appointment. Subject = "title ";
Appointment. Body = "content ";
Appointment. Start = datetime. now;
Appointment. End = new datetime (2011, 8, 8, 12, 12, 0 );
Session. Appointments. Items. Add (appointment );
// Add a contact
Contact contact = new contact ();
Contact. firstname = "John ";
Contact. lastname = "Lee ";
Contact. companyName = "company name ";
Contact. email1address = "email ";
Contact. mobiletelephonenumber = "phone number ";
Contact. im1address = "Address ";
Session. Contacts. Items. Add (contact );
// Add a task
Task task = new task ();
Task. Subject = "title ";
Task. Body = "content ";
Session. Tasks. Items. Add (task );
We create appointment, contact, and task objects, set the corresponding attributes, and add them to the corresponding attributes of the outlooksession object.
5. other new features
In addition to the above features, Windows Mobile also supports some other new features. For exampleImage DisplayWindows Mobile supports DirectX 3D mobile .. . NET applications can be called through the Microsoft. windowsmobile. DirectX class library.D3d mobileC ++ applications can be called through the COM interface.
Widely used on Windows Mobile DevicesGPS Global Positioning SystemIt also got better support. Windows Mobile provides the GPS intermediate driver so that applications can use a unified API to call the GPS system.
Windows Mobile provides a function called "exitwindowsex" that allows softwareRestart the Operating System. Pocket PC can use this function to restart the system, while smartphone supports shutdown and restart.
In terms of databases, SQL mobile is widely used, but SQL mobile is not installed in Rom. Therefore, if you need SQL mobile, You need to occupy some RAM memory space, which is not suitable for some lightweight applications. Therefore, Windows Mobile also includes a lightweight database, EDB, Which is upgraded to CEDB.
New features provided by Windows Mobile for developers. Many common features are added to the API. However, we also need to see that many new features are simple for complex applications. If you want to implement complex functions, you also need to use custom controls.