TransportConnect
The TransportConnect function connects to a service for transmission or reception.
Syntax
BOOL TransportConnect(HANDLE hService, DWORD dwFlags, HWND hNotify, (BOOL) (*CallBack)(int iStatus, BOOL bUnknownmax));
At a Glance
Header file: |
Smtp.h |
Platforms: |
H/PC |
Windows CE versions: |
1.0 and later |
Parameters
- hService
- Handle to a SERVICE structure.
- dwFlags
- Transmit and receive flags. The following flags can be set:
- 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
- Handle to the window that will receive 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.
- 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
- 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.
Note The CallBack parameter implemented in the Inbox client application always returns TRUE.
Return Values
If the transmit or receive service connection succeeds, TransportConnect returns TRUE. If hService is invalid or if the connection fails, then FALSE is returned.
Remarks
The TransportConnect function must be implemented by the transport service provider in a DLL registered as a mail service. The Inbox application loads this DLL when the user selects the service and calls TransportConnect to connect to the service.
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.
See Also
TransportDisconnect