LInet::GetFirstItem
#include "ltwrappr.h"
LInet * LInet::GetFirstItem(plRemoteComp=NULL)
LInet * 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 LUserInetGFI class LUserInetGFI : public LInet { protected: virtual L_INT OnConnect(LInet *plConnection, L_INT nError); }; L_INT LInet__GetFirstItemExample() { L_INT nRet; LUserInetGFI UserInet; // other operations // connect to LEAD nRet = UserInet.Connect("207.238.49.190", 1000); if(nRet != SUCCESS) return nRet; return SUCCESS; } L_INT LUserInetGFI::OnConnect(LInet *plConnection, L_INT nError) { UNREFERENCED_PARAMETER(nError); LInet* plRemote = NULL; L_TCHAR* pName; L_TCHAR szString[256]; plRemote = GetFirstItem(plConnection); if (plRemote != NULL) { pName = (L_TCHAR*) plRemote->GetHostName(); wsprintf(szString, TEXT("Host name of the first server connection: %s"), pName); MessageBox(NULL, szString, TEXT(""), MB_OK); } return SUCCESS; }