Problem using COleVariant with ActiveX MSComm (VC++ 6)

I want to send some Bytes to the Serial-Port.

I use the Microsoft Communication Control V6.0 and

Microsoft Visual C++ 6.0.

Writing a String to the serial Port is no problem.

I typed:

COleVariant vTest;

vTest = "Testoutput";


It worked!

But then I wanted to write a Byte to the serial Port:

COleVariant vTest2;

vTest2 = 0x05;


I got a Compiler-Error;

Operator = is ambiguous (Operator = ist mehrdeutig).

I tried to use a cast operator:

COleVariant vTest3;

vTest3 = (BYTE) 0x05;


There is no compiler-error.

But at Runtime i got the Message from

MSComm "wrong Propertyvalue"

(falscher Eigenschaftswert);

I have also tried to use the original VARIANT

Datatype, but without positive result.


vTest4.vt = VT_UI1;

vTest4.bVal = 0x05;


I got the same Runtime Error as the one

with vTest3.

Is there someone who can help me please?

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!