DimOutputAsciiAsBooleanDimInputStringAsStringDimOutputStringAsString'变量定义OptionExplicit'强制显式声明DimComSwitchAsBoolean'串口开关状态判断DimFileDataAsString'要发送的文件暂存DimSendCountAsLong'发送数据字节计数器DimReceiveCountAsLong'接收数据字节计数器DimInputSignalAsString'接收缓冲暂存DimOutputSignalAsString'发送数据暂存DimDisplaySwitchAsBoolean'显示开关DimModeSendAsBoolean'发送方式判断DimSavetimeAsSingle'时间数据暂存延时用DimSaveTextPathAsString'保存文本路径'网页超链接申明PrivateDeclareFunctionShellExecuteLib"shell32.dll"Alias"ShellExecuteA"(ByValhwndAsLong,ByVallpOperationAsString,ByVallpFileAsString,ByVallpParametersAsString,ByVallpDirectoryAsString,ByValnShowCmdAsLongAsLongPrivateSubCloseCom('关闭串口OnErrorGoToErrIfMSComm.PortOpen=TrueThenMSComm.PortOpen=False'先判断串口是否打开,如果打开则先关闭txtstatus.Text="STATUS:COMPortCloced"'串口状态显示mnuconnect.Caption="断开串口"cmdswitch.Caption="打开串口"'ImgSwitch.Picture=LoadPicture("f:\我的 VB\串口调试软件\图片\guan.jpg"'显示串口已经关闭的图标ImgSwitchoff.Visible=TrueImgSwitchon.Visible=FalseErr:EndSubPrivateSubUpdateStatus(IfMSComm.PortOpenThenStatusBar1.Panels(1.Text="Connected"mnuautosend.Caption="自动发送"mnuconnect.Caption="断开串口"ElseStatusBar1.Panels(1.Text="断开串口"mnuautosend.Caption="disautosend"mnuconnect.Caption="打开串口"EndIfStatusBar1.Panels(2.Text="COM"&MSComm.CommPortStatusBar1.Panels(3.Text=MSComm.SettingsIf(OutputAsciiThenStatusBar1.Panels(4="ASCII"ElseStatusBar1.Panels(4="HEX"EndIf!OnErrorGoToErrIfChkAutoSend.Value=1Then'如果有效则,自动发送IfMSComm.PortOpen=TrueThen'串口状态判断mnuautosend.Caption="Dis&autosend"TmrAutoSend.Interval=Val(TxtAutoSendTime'设置自动发送时间TmrAutoSend.Enabled=True'打开自动发送定时器Elsemnuautosend.Caption="autosend"ChkAutoSend.Value=0'串口没有打开去掉自动发送MsgBox"串口没有打开,请打开串口",48,"串口调试助手"'如果串口没有被打开,提示打开串口EndIfElseIfChkAutoSend.Value=0Then'如果无效,不发送mnuautosend.Caption="autosend"TmrAutoSend.Enabled=False'关闭自动发送...