MSComm write serial communication driver steps

Source: Internet
Author: User

1. Add the initialization code in oninitdialog ().

Bool cscommtestdlg: oninitdialog () {cdialog: oninitdialog (); // todo: add additional initialization code m_ctrlcomm.put_commp ORT (1); merge (1024); merge (512 ); m_ctrlcomm.put_settings (_ T ("9600, N, 8, 1"); If (! Values () m_ctrlcomm.put_portopen (true); values (1); m_ctrlcomm.put_inputlen (0); m_ctrlcomm.get_input (); Return true; // return true unless focus is set to the control}

2. Add the receiving code in oncommmscomm1.

Void cscommtestdlg: oncommmscomm1 () {// todo: add the message processing program code variant variant_6b; cstring strtemp; If (m_ctrlcomm.get_commevent () = 2) {variant_indium = m_ctrlcomm.get_input (); strtemp = variant_indium; m_streditrxdata + = strtemp;} updatedata (false );}

3. Add the sending code in onbnclickedbuttonmunualsend ().

 

Void cscommtestdlg: onbnclickedbuttonmunualsend () {// todo: add the control notification handler code updatedata (true); m_ctrlcomm.put_output (colevariant (m_stredittxdata ));}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.