Chapter 44
email.Subject = “Sample Email”
email.BodyText = “This email contains sample text to show how easy
email is...”
poom.EmailAccounts(0).Send(email) End Using
End Sub End Class
Status
The Status namespace contains a wealth of information about the status of the device, including static attributes, such as whether there is a camera on the device, and dynamic attributes, such as the ActiveSync status. The following example shows how these two attributes can be queried:
Imports Microsoft.WindowsMobile
Public Class Form1
Private Sub StatusExample(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles
SampleButton.Click
If Status.SystemState.ActiveSyncStatus = _
Status.ActiveSyncStatus.Synchronizing Then _
MsgBox(“Active sync is synchronising now, don’t go away!”)
If Status.SystemState.CameraPresent = True Then _
MsgBox(“There is a camera, why not take a photo”)
End Sub
End Class
Registry entries can also be queried using the RegistryState class in this namespace.
Telephony
The Telephony namespace contains a single class, Phone, which has a single static method called Talk, which can be used to initiate a phone call. An optional parameter, showPrompt, determines whether the user is prompted to proceed with the call or not. In the following code, the user is not prompted before the call is initiated:
Imports Microsoft.WindowsMobile Public Class Form1
Private Sub TelephonyExample(ByVal sender As System.Object, _ ByVal e As System.EventArgs) _
Handles SampleButton.Click
Dim t As New Telephony.Phone t.Talk(“0412413425”, False)
End Sub End Class
Notification Broker
One of the significant improvements in Windows Mobile 5.0 is the Notification Broker, which can be used to notify an application of a particular system event. This may be a change in any of the status states or it may be an incoming SMS or e-mail. The following example shows how you can register your application to intercept an SMS containing a particular string (in this case, “::”). If an incoming SMS is