Nonvisual user objects in PocketBuilder provide support for sending Short Message Service (SMS) messages from applications that you deploy to devices that use the SMS messaging protocol. This includes the "Phone Editions" of Pocket PC devices, as well as all Smartphone platforms. SMS involves the combination of text-based e-mail (although other types of data can be sent) and a paging mechanism.
The SMSSession object provides the interface for a PocketBuilder application and the SMS messaging system on a Pocket PC or Smartphone device. It also provides access to the SMSAddress, SMSMessage, and SMSProtocol objects.
You can also receive SMS messages in PocketBuilder applications running on Windows Mobile 2003 platforms. PocketBuilder provides a shim DLL, PKSMS20.DLL, that contains a COM object that hooks into the SMS processor. The DLL should be copied to the \Windows directory of a Pocket PC device or the \Storage\Windows directory of a Smartphone device. You must register the DLL with the operating system, then perform a soft reset on the device.
You can deploy the DLL along with registry settings in the CAB file you create for a customer application. The DLL is not part of the standard CAB file that you generate from the PocketBuilder Project painter. You can use the Enhanced CAB Generation tool to add the PKSMS20.DLL file to the CAB file, or you can add it manually.
To register the DLL, you can use the Enhanced CAB Generation tool (see “Support for SMS receiving in generated CAB files”) or either of the following approaches:
Call DLLRegisterServer from your PocketBuilder application.
Modify the INI for the CAB file to add the required registry keys manually.
First you register the server:
[HKEY_CLASSES_ROOT\CLSID\{CA08D891-1E24-4c69-A313-453B1120E558}\InProcServer32] @="PKSMS20.dll"
[HKEY_CLASSES_ROOT\CLSID\{CA08D891-1E24-4c69-A313-453B1120E558}]ReadOnly = dword: #
The ReadOnly value (#) can be 0 or 1. If you register the DLL by calling DLLRegisterServer, this value is automatically set to 0 (false).
When ReadOnly = dword: 0
and
you return true for an SMSSession IncomingMessage
event, PocketBuilder attempts to prevent an incoming SMS message
from displaying in the SMS inbox. PocketBuilder can fail in this
attempt when other phone-related activity interferes with
the request for nondisplay of the incoming message. In some configuations,
it is possible that the shim DLL will be prevented from operating
unless the ReadOnly attribute is set to 1.
When ReadOnly = dword: 1
,
the application will be notified of incoming SMS messages, but PocketBuilder
will not be able to delete the incoming messages from the SMS inbox
regardless of what the IncomingMessage event returns.
Next you register the inbox processor:
[HKEY_LOCAL_MACHINE\Software\Microsoft\Inbox\Svc\ SMS\Rules]{CA08D891-1E24-4c69-A313-453B1120E558} = dword:1
In order to receive SMS messages in an application, you must set the second argument in the Open call for the SMSSession object to 2 or 3.
Unregistering a DLL You can unregister the DLL by calling DLLUnregisterServer from your application. You must perform a soft reset after you unregister a DLL.
The Other Options tab page in the Enhanced CAB Generation tool has check boxes that let you include the following in a CAB file that you deploy to a device:
The SMS reception DLL, PKSMS20.DLL
You must select the check box to include PocketBuilder support DLLs. This enables the check box that lets you include the SMS reception DLL.
Registry entries for SMS reception in a PocketBuilder application
If you select this option and generate a CAB file with the Enhanced CAB Generation tool, unzipping the CAB file on the deployment device automatically inserts the required entries in the device registry.
A modification to the ReadOnly
string
of the SMS reception DLL registry entry
If the check box labeled SMS Reception is Read Only is selected
when you generate a CAB file with the Enhanced CAB Generation tool,
unzipping the CAB file on the deployment device automatically assigns
a ReadOnly
value of 1. This
makes PocketBuilder applications unable to delete incoming messages
from the SMS inbox.
You access the Enhanced CAB Generation tool on the Tool tab of the New dialog box.
Properties and functions of the SMSSession, SMSAddress, SMSMessage, and SMSProtocol objects are described in the PowerScript Reference and in the online Help.