Click to See Complete Forum and Search --> : This is so frustrating


Bryan DeNosky
March 30th, 1999, 10:23 PM
I am trying to send out the contents of a CString out a port. I have the ole Microsoft Communications Control all set

up in my project. Here is the code I have when you click to send the data.

//*******My code starts here*******

//lumps all the messages together and readies for sendout

CString m_sendall = m_display1 + m_display2 + m_display3;

//initializes port1, sends it out, and closes port

m_sendmessagesout.SetPortOpen(TRUE);

m_sendmessagesout.SetOutput(m_sendall);

m_sendmessagesout.SetPortOpen(FALSE);

//*******My code ends here

m_sendmessagesout.SetOutput(m_sendall) won't work.

It says:"C:\Msdev\Projects\SignWare1\SignWareDlg.cpp(324) : error C2664: 'SetOutput' : cannot convert parameter 1 from

'class CString' to 'const struct tagVARIANT &' (new behavior; please see help)"

Could someone just tell me how to shove this crap out the port? I would greatly appreciate it.

Dazza
March 31st, 1999, 02:18 AM
SetOutput requires a VARIANT datatype. ATL wraps a VARIANT with the CComVariant class and MFC uses COleVariant, or you can use the compiler type _variant_t - take your pick. I would try constructing a VARIANT of type VT_BSTR.


Also, be a bit careful with your booleans, I suspect you should be using VARIANT_TRUE and VARIANT_FALSE rather than TRUE and FALSE.