LInet::m_pUserDataEx

#include "ltwrappr.h"

L_VOID *LInet::m_pUserDataEx

Comments

A void pointer to be used for any extra data the user needs.

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.

Example

class LUserInet : public LInet
{
protected:
   virtual  L_INT OnConnect(LInet L_FAR *plConnection, L_INT nError);
   virtual  L_INT OnClose(LInet L_FAR *plConnection, L_INT nError);
};



LUserInet UserInet;
UserInet.StartUp();

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

// … other operations;

LInet L_FAR *plConnection = UserInet.GetFirstItem();
if(plConnection)
{
   plConnection->Close(FALSE);

   if(plConnection->m_pUserDataEx)
   {
        MessageBox(NULL,TEXT(" User Data "), (L_TCHAR *)plConnection->m_pUserDataEx,MB_OK| 
         MB_APPLMODAL);
         // free the m_pUserDataEx;

      delete []plConnection->m_pUserDataEx; 
      plConnection->m_pUserDataEx = NULL;
   }
}

// Callback functions
L_INT LUserInet::OnConnect(LInet L_FAR *plConnection, L_INT nError)
{
   if(plConnection)
   {
       L_TCHAR*  name  =  TEXT("This is Data for user");
       plConnection->m_pUserDataEx = (L_VOID *)new L_TCHAR[50];
       memcpy(plConnection->m_pUserDataEx, name, lstrlen(name)); 
   }
   return 0;

}

L_INT LUserInet::OnClose(LInet L_FAR *plConnection, L_INT nError)
{
   if(plConnection && plConnection->m_pUserDataEx)
   {
      MessageBox(NULL,TEXT(" User Data "), (L_TCHAR *)plConnection->m_pUserDataEx,MB_OK| 
       MB_APPLMODAL);

      delete []plConnection->m_pUserDataEx;
      plConnection->m_pUserDataEx = NULL;
   }
   return 0;

}