I have a piece of code to send a string using MS Comm control, (i got it from a message by Andy Paches)

He says it works, but when i run this it gives assertion error!

Do I have to open the port first?

Here is the code:

CMSComm mycomm ; //object of class comm control

VARIANT var ;

CString strSend = "12345678";

var.vt = VT_BSTR ;

var.bstrVal = strSend.AllocSysString();

mycomm.SetOutput(var); // when reaches here, it gives assertion error