This code sample is named FileClient. It demonstrates how to implement a push-client that receives push-messages, saves the message's body to a file, and then calls ShellExecuteEx to perform an action on the file (which can be an executable file or a document).
- PushRouter_Close function
- PushRouter_FreeMessage function
- PushRouter_GetMessage function
- PushRouter_Open function
- PushRouter_RegisterClient function
- PushRouter_UnRegisterClient function
- ShellExecuteEx function
- SHELLEXECUTEINFO structure
- Wireless Application Protocol (WAP) API
Source File Listing
Contains functions for saving a file, getting user permissions, checking to see if the file type has permissions for download, and processing push-messages.
Contains function prototypes and forward declarations for string constants.
The resource script.
Contains the application entry point.
Defines the precompiled header.
the header file for the resource script.
Defines all constant string values.
Contains functions for extracting data from the SMS header, and for copying strings.
To run the code sample
Navigate to the solution file (*.sln), and double-click it. By default, the solution files are copied to the following folders:
C:\Program Files\Windows Mobile 6 SDK\Samples\Common\CPP\Win32\fileclient
Microsoft Visual Studio 2005 launches and loads the solution.
Build the solution (Ctrl+Shift+B).
Deploy the solution (F5).
To use the application
Register the application by running it on the mobile device once with "/register" as the command-line argument.
The application will execute when it receives an SMS message with X-WAP-Application-ID with a value of "fileclient".
Network coverage is required to receive push messages.
The Setup in a CAB code sample can be used to create a CAB file for deploying this application.
The value of the X-MS-FileName header field in the message's headers section specifies the name of the saved file.
Application parameters can be set by filling-in the X-MyCompany-Params header field.
The value of CSIDL_WINDOWS contains the name of the directory where the file is saved.
Since the message is traveling over the SMS transport, the maximum message size determines the maximum size of an application that can be pushed to a mobile device. Most Short Message Service Center's (SMSC's) limit this size to 64KB.
The Application ID of this push-client is "fileclient", To be intercepted by this push-client, a push-message must have a value of "fileclient" for the X-WAP-Application-ID header field.
SDK: Windows Mobile 6 Professional SDK and Windows Mobile 6 Standard SDK
Development Environment: Visual Studio 2005.
ActiveSync: Version 4.5.