Results 1 to 2 of 2

Thread: MSComm and SetOutput()....how?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    Dallas,TX
    Posts
    170

    MSComm and SetOutput()....how?

    I'm a little confused about the use of MSComm::SetOutput(). I'd like to output one single byte, but am not sure how to do so using the proper parameter.

    The prototype says to use a VARIANT, but I don't think I am correctly doing so.

    Can anybody help me out? Thanks for your assistance!

    Thanks,
    Phil

  2. #2
    New Member
    Join Date
    Jun 2005
    Posts
    1

    Re: MSComm and SetOutput()....how?

    Hello, maybe this is a little bit late

    since it has been almost three years since this message was posted by PhilipG. But for the last couple days I've been having the same problem. And luckily I found this code somewhere in a Chinese website (which my web browser doesn't even able to display the chinese text, but of course the codes are writen in ANSI standard character )

    The major problem of sending single byte using MSComm::SetOutput() function is about converting BYTE (unsigned char) data types into struct VARIANT data types..
    I am using the SNAP protocol (http://www.hth.com/snap/)
    so here is the codes:

    CByteArray OutBuf;
    COleVariant varOutput;
    OutBuf.SetSize(OutPacket.NumOfBytes);
    unsigned int i;

    for(i=0 ; i<OutPacket.NumOfBytes ; i++)
    {
    OutBuf[i] = OutPacket.PacketBytes[i];
    }
    varOutput = OutBuf;

    m_ctlSerialComm.SetOutput(varOutput);

    Hope this will be usefull..

    Regards,

    Leo

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width