TransportConnect

This function connects to a service for transmission or reception.

At a Glance

Header file: Smtp.h
Windows CE versions: 1.0 and later

Syntax

BOOL TransportConnect(HANDLE hService, DWORD dwFlags, HWND hNotify, (BOOL) (*CallBack)(int iStatus, BOOL bUnknownmax));

Parameters

hService

[in] Handle to a SERVICE structure.

dwFlags

[in] Specifies a bitmask of transmit and receive flags. It is one of the following values:

Value Description
TRANSPORT_SEND Indicates a request to start the transmit functionality of the service.
TRANSPORT_RECV Indicates a request to start the receive functionality of the service.

hNotify

[in] Handle to the window that receives any notification messages that may be sent from a transport service routine. The SAMPLE service can call the SendMessage function to send the following notification messages to hNotify.

Value Description
TRANSPORT_CONN_LOST (WM_USER + 1) Sent to hNotify to inform Inbox that the connection has closed in the background. For example, this could be sent if a remote modem connection was lost. The SendMessage parameters wparam and lparam are ignored. SendMessage always returns zero.
TRANSPORT_REFRESH (WM_USER + 2) Sent to hNotify to request Inbox to refresh its connection to the service. For example, this could be used if Inbox has an open connection to the service and the service determines that a new message has arrived. The SendMessage parameters wparam and lparam are ignored. SendMessage always returns zero.

CallBack

[in] If this CallBack routine is not NULL, it can be called from a Transport* function, for example. The CallBack routine displays a status window, indicating the progress toward completion.

The CallBack routine is passed an integer value between 0 and 99 (iStatus), indicating the progress toward completion. In this case, bUnknownmax must be set to FALSE.

If the maximum value of iStatus might be greater than 99 (that is, the maximum is unknown), then bUnknownmax must be set to TRUE.

Return Values

TRUE indicates success. FALSE indicates failure, or that hService is invalid.

Remarks

The transport service provider must implement the TransportConnect function in a DLL registered as a mail service. The Inbox application can then load this DLL and call this function.

The dwFlags parameter should be checked to determine whether this is a call to connect the transmit service or the receive service. The CallBack routine can be saved in the hService SERVICE structure, so that it can be called from other transport service routines.

The CallBack parameter implemented in the Inbox client application always returns TRUE.

See Also

TransportDisconnect