LInet::AddWndItem

#include "ltwrappr.h"

L_BOOL * LInet::AddWndItem(plRemoteComp)

LInet * 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 LUserInetAWI
class LUserInetAWI : public LInet
{
protected:
   virtual  L_INT OnConnect(LInet *plConnection, L_INT nError);
   virtual  L_INT OnClose(LInet *plConnection, L_INT nError);
};
L_INT LInet__AddWndItemExample()
{
   L_INT          nRet;
   LUserInetAWI   UserInet;
   LInet*         plRemote = NULL;
   // other operations
   // connect to LEAD.
   nRet = UserInet.Connect("207.238.49.190", 1000);
   if(nRet != SUCCESS)
      return nRet;
   // other operations
   // Close connection with LEAD.
   plRemote = UserInet.GetLastItem();
   if( plRemote == NULL)
      return FAILURE;
   nRet = UserInet.Close(plRemote);
   if(nRet != SUCCESS)
      return nRet;
   return SUCCESS;
}
L_INT LUserInetAWI::OnConnect(LInet *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 LUserInetAWI::OnClose(LInet *plConnection, L_INT nError)
{
   if ( nError != SUCCESS)
       return nError;
   RemoveWndItem(plConnection);
   return SUCCESS;
}