84
Visual C++ object definitions
CHostDataEx object
Visual C++ sample code for host functionality
The following sample Visual C++ function creates a host object, sets its connection
type to TCP/IP, sets the computer name to the TCP/IP address that is passed into
the function, and then launches the host object:
BOOL LaunchTCPHost(LPCTSTR lpszAddress)
{
BOOL bReturn = FALSE;
CHostDataManager hostDM;
CHostData hostData;
// First, create the CHostDataManager
hostDM.CreateDispatch( _T( "WINAWSVR.BeHostDataManager") );
// Next, create CRemoteData and attach it
hostData.AttachDispatch(hostDM.CreateObject("Test", 0) );
// Now, set the required properties
hostData.SetConnectionType("TCP/IP");
// Save the object data
if (hostData.WriteObject(0))
{
// And launch it
if (hostData.Launch())
bReturn = TRUE;
}
// Release the Host object.
hostData.ReleaseDispatch();
return (bReturn);
}