CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 1999
    Posts
    3

    This is so frustrating



    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.



  2. #2
    Join Date
    Apr 1999
    Posts
    24

    Re: This is so frustrating



    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.




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

Featured