Push Messaging

Windows Mobile SupportedWindows Embedded CE Not Supported


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).

Feature Area

Relevant APIs

Source File Listing

  • fileclient.cpp
    Contains functions for saving a file, getting user permissions, checking to see if the file type has permissions for download, and processing push-messages.
  • fileclient.h
    Contains function prototypes and forward declarations for string constants.
  • fileclient.rc
    The resource script.
  • main.cpp
    Contains the application entry point.
  • precomp.h
    Defines the precompiled header.
  • resource.h
    the header file for the resource script.
  • string.cpp
    Defines all constant string values.
  • utils.cpp
    Contains functions for extracting data from the SMS header, and for copying strings.


To run the code sample

  1. 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.

  2. Build the solution (Ctrl+Shift+B).

  3. Deploy the solution (F5).

To use the application

  1. Register the application by running it on the mobile device once with "/register" as the command-line argument.

  2. 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.

Development Environments

SDK: Windows Mobile 6 Professional SDK and Windows Mobile 6 Standard SDK

Development Environment: Visual Studio 2005.

ActiveSync: Version 4.5.

See Also


Code Samples for Windows Mobile
Setup in a CAB

Other Resources

Push Message Features
Data from Push Router
WAP Push Message Format
Setting Push Router Policies
WAP Push OTA Protocol Features
Security Roles