Load

The Load function is the main entry point to download an application from the desktop PC to the target device.

Syntax

LOADERROR Load(HWND hwndParent, LPSTRlpszCmdLine);

At a Glance

Header file: Ppcload.h
Platforms: H/PC
Windows CE versions: 1.0 and 1.01

Parameters

hwndParent
Handle to the parent window; used for displaying the progress bar.
lpszCmdLine
Pointer to the buffer containing the command-line string of arguments to be parsed:

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. Following is a description of the lpszCmdLine command-line parameters:

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 PC containing 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

This function returns one of the following error values:

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 PC—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 version 2.0. For more information on installing applications for version 2.0, see Installing Applications.

See Also

Load_Init, Load_Exit