Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pcAnywhere OLE C++ problem

Status
Not open for further replies.

DaFonz

Programmer
Dec 12, 2004
2
0
0
NL
Hi,

I am not too experienced with OLE.
I have PCA 10.5 and had ClassWizard generate wrapper class for my MFC based application in Visual Studio 6.
I imported both winawsvr.tlb and awrem32.tlb, included the .h files of the generated wrapper class and then have this code, based on the sample as described in the pca_105_ole.pdf :

Code:
	BOOL bReturn = FALSE;

	IRemoteDataManager remoteDM;
	IRemoteData remoteData;

	// First, create the CRemoteDataManager
	remoteDM.CreateDispatch( _T("WINAWSVR.RemoteDataManager"), &e ))

	// Next, create CRemoteData and attach it
	// AccessMode:
	// 0 = Not specified
	// 1 = View only
	// 2 = View and Modify
	// 3 = Execute
	LPDISPATCH lpDispatch = remoteDM.RetrieveObject(_T("Test"), 2, NULL);
	if (lpDispatch == NULL)
		lpDispatch = remoteDM.CreateObject(_T("Test"));

	if (lpDispatch == NULL)
	{
		remoteDM.ReleaseDispatch();
		return FALSE;
	}

	remoteData.AttachDispatch(lpDispatch);

	// Now, set the required properties
	remoteData.SetConnectionType(_T("TCP/IP"));
	remoteData.SetComputerName(_T("10.0.0.1"));

	// Save the object data
	if (remoteData.WriteObject(0))
	{
		// And launch it
		if (remoteData.Launch())
			bReturn = TRUE;
	}

	// Release the remote object.
	remoteData.ReleaseDispatch();
	remoteDM.ReleaseDispatch();

	return bReturn;

The function fails in remoteData.WriteObject(0) with:

Warning: constructing COleException, scode = DISP_E_BADPARAMCOUNT ($8002000E) (Invalid number of parameters)


The WriteObject wrapper shows:

Code:
BOOL IRemoteData::WriteObject(LPCTSTR lpszPassword)
{
	BOOL result;
	static BYTE parms[] =
		VTS_BSTR;
	InvokeHelper(0x2b, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
		lpszPassword);
	return result;
}

Does anybody have a clue why I get this error?
Please help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top