LInet::AddWndItem

#include "ltwrappr.h"

L_BOOL * LInet::AddWndItem(plRemoteComp)

LInet L_FAR * plRemoteComp;

/* instance of a remote computer */

Add a remote computer to the connection list window.

Parameter

Description

plRemoteComp

Instance of a remote computer to be added to the connection list window.

Returns

TRUE

Remote computer has been added.

FALSE

Remote computer was not added.

Comments

If the user uses LInet::EnableAutoWnd, then the remote computer will be added automatically to the window.

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::RemoveWndItem, LInet::RemoveAllWndItems, LInet::IsWndItem, Class Members

Example

// A user defined class derived from LInet should be used to support the OnConnect 
// and OnClose callback functions.
// Suppose it was named as LUserInet

LUserInet UserInet;
LInet *plRemote = NULL;

// other operations

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

// other operations

// Close connection with LEAD.
plRemote = UserInet.GetLastItem();
if( plRemote == NULL)
    return;

UserInet.Close(plRemote);

L_INT LUserInet::OnConnect(LInet L_FAR *plConnection, L_INT nError)
{
   if ( nError != SUCCESS)
       return nError;

   if (IsWndItem(plConnection) > -1)
   {
       LBase::DisplayError(NULL, TEXT("Remote computer already exists in connection list."));
       return FAILURE;
   }

   if (AddWndItem(plConnection) == FALSE);
        return FAILURE;

   return SUCCESS;
}

L_INT LUserInet::OnClose(LInet L_FAR *plConnection, L_INT nError)
{
   if ( nError != SUCCESS)
       return nError;

   RemoveWndItem(plConnection);

   return SUCCESS;
}