Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
4/8/2010

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

Usage

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.5.3 DTK\Samples\Common\CPP\Win32\fileclient

    Microsoft Visual Studio 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-IDwith a value of "fileclient".

Remarks

Network coverage is required to receive push messages.

The Setup in a CABcode sample can be used to create a CAB file for deploying this application.

The value of the X-MS-FileNameheader 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-Paramsheader field.

The value of CSIDL_WINDOWScontains 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-IDheader field.

Development Environments

SDK:Windows Mobile Professional SDK and Windows Mobile Standard SDK

Development Environment:Visual Studio 2005 or 2008.

ActiveSync:Version 4.5.

See Also