资源描述:
《串口调试助手源码.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、串口调试助手程序框架(一)【截图】【源码】main.cpp#include#include#include#include#include"resource.h"usingnamespacestd;HINSTANCEhInst;//窗口实例HWNDhRDCLEAR,hSDCLEAR;HMENUhRDCHAR;voidInit(HWNDhwndDlg){SetWindowText(GetDlgItem(hwndDlg,SETXONC),"0x13");SetWindowText
2、(GetDlgItem(hwndDlg,SETXOFFC),"0x19");SetWindowText(GetDlgItem(hwndDlg,SETTO),"0");SendDlgItemMessage(hwndDlg,RDCHAR,BM_SETCHECK,1,0);//把RadioBoxRDCHAR设置为选中SendDlgItemMessage(hwndDlg,SDCHAR,BM_SETCHECK,1,0);//默认发送字符SendDlgItemMessage(hwndDlg,CTASY,BM_SETCHECK,1,0);//默认异步通信//在一个grou
3、pbox中必须有一个radiobox的属性:组为真//串口号SetWindowText(GetDlgItem(hwndDlg,SETCOMNO),"COM4");//默认值SendDlgItemMessage(hwndDlg,SETCOMNO,CB_ADDSTRING,0,(LPARAM)("COM1"));SendDlgItemMessage(hwndDlg,SETCOMNO,CB_ADDSTRING,0,(LPARAM)("COM2"));SendDlgItemMessage(hwndDlg,SETCOMNO,CB_ADDSTRING,0,(LPARAM
4、)("COM3"));SendDlgItemMessage(hwndDlg,SETCOMNO,CB_ADDSTRING,0,(LPARAM)("COM4"));SendDlgItemMessage(hwndDlg,SETCOMNO,CB_ADDSTRING,0,(LPARAM)("COM5"));SendDlgItemMessage(hwndDlg,SETCOMNO,CB_ADDSTRING,0,(LPARAM)("COM6"));SendDlgItemMessage(hwndDlg,SETCOMNO,CB_ADDSTRING,0,(LPARAM)("COM
5、7"));SendDlgItemMessage(hwndDlg,SETCOMNO,CB_ADDSTRING,0,(LPARAM)("COM8"));SendDlgItemMessage(hwndDlg,SETCOMNO,CB_ADDSTRING,0,(LPARAM)("COM9"));//波特率SetWindowText(GetDlgItem(hwndDlg,SETBR),"9600");//默认值SendDlgItemMessage(hwndDlg,SETBR,CB_ADDSTRING,0,(LPARAM)("1200"));SendDlgItemMess
6、age(hwndDlg,SETBR,CB_ADDSTRING,0,(LPARAM)("2400"));SendDlgItemMessage(hwndDlg,SETBR,CB_ADDSTRING,0,(LPARAM)("4800"));SendDlgItemMessage(hwndDlg,SETBR,CB_ADDSTRING,0,(LPARAM)("9600"));SendDlgItemMessage(hwndDlg,SETBR,CB_ADDSTRING,0,(LPARAM)("14400"));SendDlgItemMessage(hwndDlg,SETBR
7、,CB_ADDSTRING,0,(LPARAM)("28800"));SendDlgItemMessage(hwndDlg,SETBR,CB_ADDSTRING,0,(LPARAM)("38400"));SendDlgItemMessage(hwndDlg,SETBR,CB_ADDSTRING,0,(LPARAM)("57600"));SendDlgItemMessage(hwndDlg,SETBR,CB_ADDSTRING,0,(LPARAM)(""));//数据位SetWindowText(GetDlgItem(hwndDlg,SETBS),"8");/
8、/默认值SendDlgItemMessage(hwn