Load

This function is the main entry point to download an application from the desktop computer to the target device.

At a Glance

Header file: Ppcload.h
Windows CE versions: 1.0 and 1.01

Syntax

LOADERROR Load(HWND hwndParent, LPSTRlpszCmdLine);

Parameters

hwndParent

Handle to the parent window; used for displaying the progress bar.

lpszCmdLine

Long pointer to the buffer that contains the command-line null-terminated string of arguments to be parsed, as follows:

cpu_type  application_name  install_directory  total_bytes_to_copy
user_name  user_company  load_file

The command-line arguments must be separated from one another by a space character. All of the items except total_bytes_to_copy should be enclosed by double quote (“) characters. The following is a description of the lpszCmdLine command-line parameters:

Value Description
cpu_type Type of CPU on the target platform device. This information can be obtained by calling the Load_PegCpuType function.
application_name Unique name for the application. This information is used to create a key in the Windows CE registry for storing information about the application.
install_directory Directory on the target platform device where the application will be stored. Directory names must begin with a backslash (\).
total_bytes_to_copy Total number of bytes to be copied to the device. The application installer uses this number to set the range of the progress bar displayed during the load process.
user_name Name of the person using the device. Currently, this parameter is unused and should be an empty string, (“”).
user_company Name of the organization where the person using the device works. Currently, this parameter is unused and should be an empty string, (“”).
load_file Path and name of the file on the desktop computer that contains the list of application installation statements to be executed during the load procedure. This file must be of the form “application_name.load”.

Return Values

One of the following values is returned:

LOAD_ALREADY_LOADING

A previous call to the Load function has not yet completed.

LOAD_SUCCESS

Load process completed successfully.

LOAD_OUTOFSTORAGE

Out of memory on the device.

LOAD_CANCELLEDBYUSER

Load canceled by the user.

LOAD_INVALID_PARAMETER

Invalid command line parameter.

LOAD_FAILED

Generic load failure.

LOAD_FAILEDCANTCLEANUP

Load failure; clean-up cannot be performed on the device.

LOAD_DISCONNECTED

Communications disconnected.

LOAD_CANT_CREATE_DIR

Cannot create the destination directory.

LOAD_REG_ERROR

Cannot create the registry entry.

LOAD_ERROR

Unknown error.

Remarks

The Load function requires a prior successful call to the Load_Init function.

Load is exported by Ppcload.dll, which runs on the desktop computer—it is intended to be called from a setup program.

The file name specified by the application_name parameter must match the file name specified by the load_file parameter. For example, if application_name is “MyFile” the file specified by load_file should be “MyFile.load”.

This function is not supported on Windows CE versions 2.0 and later. For more information on installing applications for versions 2.0 and later, see Connection Services.

See Also

Load_Init, Load_Exit