TWUOpenUpdateURL

The TWUOpenUpdateURL function opens a Tarma WebUpdate session, connects to the remote (or local) server, and downloads the package information file. The session must eventually be closed by a call to TWUCloseSession.

This function combines the functionality of TWUOpenSession and TWUGetPIF. In most cases, you will find this the most convenient way of starting a Tarma WebUpdate session. However, if you need greater control over the connection, you may prefer to use separate calls to TWUOpenSession and TWUGetPIF instead.

URESULT TWUOpenUpdateURL(
    const TCHAR *pszPIFURL,
    fTWUCallback pfCallback,
    LPARAM lCallbackCookie,
    HWND hwndParent,
    TWUHANDLE *phSession
);

Delphi version:

function TWUOpenUpdateURL(
    pszPIFURL: PTCHAR;
    pfCallback: fTWUCallback;
    lCallbackCookie: LPARAM;
    hwndParent: HWND;
    var phSession: TWUHANDLE
): URESULT;

Parameters

pszPIFPath
[Input] Fully qualified URL to the package information file that you want to download and parse. This must include the protocol specifier. Some examples of valid URLs:

file://machine/share/updates/wizupdate.txt
ftp://ftp.tarma.com/public/wizupdate.txt
https://tarma.com/download/wizupdate.txt
https://secure.tarma.com/download/wizupdate.txt

Be sure to include the file:// prefix if you are referring to a local or UNC file path.
pCallback
[Input] Pointer to the callback function that will be called when significant events occur and when progress is being made during file downloads. If you set this parameter to NULL, no callback function will be called.
lCallbackCookie
[Input] User-defined value that will be passed unchanged to the callback function. You can use this cookie to pass additional information to the callback function.
hwndParent
[Input] Handle of parent window for the session, or NULL if there is no parent window. The parent window handle is used if a message box or some similar window must be displayed during the session; in that case, the parent window is disabled while the secondary window is active.
phSession
[Output] Pointer to a variable that receives the session handle if the session could be opened and the package information file downloaded and parsed.

Return value

If the function succeeds, it returns ERROR_SUCCESS (0). If it fails, it returns a nonzero Win32 API error code. You can use TWUGetErrorMessage to retrieve the error message that corresponds to the error code.