LInet::GetFirstItem

#include "ltwrappr.h"

LInet L_FAR * LInet::GetFirstItem(plRemoteComp=NULL)

LInet L_FAR * plRemoteComp;

/* instance of a remote computer */

Retrieves the first remote computer in the internal connection list based on plRemoteComp.

Parameter

Description

plRemoteComp

Instance of a remote computer.

Returns

Pointer to an LInet class object that contains the retrieved remote computer.

Comments

If plRemoteComp = NULL, the function will retrieve the first remote computer in the internal connection list.

If plRemoteComp <> NULL, the function will retrieve the first remote computer in the internal connection list that has the same type (Server or client), as plRemoteComp.

Do not delete the returned instance pointer.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

LInet::ExistsItem, LInet::GetItem, LInet::GetLastItem, LInet::GetNextItem, LInet::GetPrevItem, LInet::GetItemsCount, Class Members

Example

// a user defined class derived from LInet should be used to support the OnConnect callback functions
// suppose it was named as LUserInet
LUserInet UserInet;

// other operations

// connect to LEAD
UserInet.Connect(TEXT("207.238.49.190"), 1000);

L_INT LUserInet::OnConnect(LInet L_FAR *plConnection, L_INT nError)
{
    LInet L_FAR *plRemote = NULL;
    L_TCHAR *pName;
    L_TCHAR szString[256];

    plRemote = GetFirstItem(plConnection);
    if (plRemote != NULL)
    {
        pName = plRemote->GetHostName();
        wsprintf(szString, TEXT("Host name of the first server connection: %s"), pName);
        MessageBox(NULL, szString, TEXT(""), MB_OK);
    }
    return SUCCESS;}