VB串口曲线显示源码.docx
Forml.frm源码VERSION5.00BeginVB.FormFormlBorderStyIe=1'FixedSingleCaption="实时曲线”CIientHeight=6690CIientLeft=45CIientTop=495CIientWidth=9840Icon="FormLfrx”:00001.inkTopic="Forml"MaxButton=0'FalseMinButton=0'FalseScaIeHeight=6690ScaIeWidth=9840StartUpPosition=3'窗口缺省BeginVB1PictureBoxPicturelAutoRedraw=-1'TrueBackCoIor=&H80000012&Height=2175Left=120ScaIeHeight=2115ScaIeWidth=9585Tabindex=4Top=120Width=9650EndBeginVB1PictureBoxPictureJineAutoRedraw=-1'TrueBackCoIor=&H80000012&Height=2145Left=120ScaIeHeight=2085ScaIeWidth=4785Tabindex=3Top=2280Width=4845EndBeginVB1PictureBoxPicture_pointAutoRedraw=-1'TrueBackCoIor=&H80000012&Height=2145Left=120ScaIeHeight=2085ScaIeWidth=4785Tabindex=2Top=4440Width=4845EndBeginVB1PictureBoxPicturejine2AutoRedraw=-1'TrueBackCoIor=&H80000012&Height=2145Left=4920ScaIeHeight=2085ScaIeWidth=4785Tabindex=1Top=2280Width=4845EndBeginVB1PictureBoxPicture_point2AutoRedraw=-1'TrueBackCoIor=&H80000012&Height=2145Left=4920ScaIeHeight=2085ScaIeWidth=4785Tabindex=OTop=4440Width=4845EndEndAttributeVB_Name="Forml"AttributeVB_GlobalNameSpace=FalseAttributeVB_Creatable=FalseAttributeVB_Predeclaredld=TrueAttributeVB_Exposed=FalseOptionExplicitPrivateSubForm_Load()WithLDrawl.InitDrawLinePictureJine,vbRed,True.Max=5.HorzSpIits=6.VertSpIits=6.LineType=TYPE-LINE.RePaintEndWithWithPDrawl.InitDrawLinePicture_point,vbRedzTrue.Max=5.HorzSpIits=6.VertSpIits=6.LineType=TYPE_P0INT.RePaintEndWithWithLDraw2.InitDrawLinePicturejine2,vbRed,True.Max=5.HorzSpIits=6.VertSpIits=6.LineType=TYPE-LINE.RePaintEndWithWithPDraw2.InitDrawLinePicture_point2,vbRedzTrue.Max=5.HorzSpIits=6.VertSpIits=6.LineType=TYPE_P0INT.RePaintEndWithWithPDraw3.InitDrawLinePicturelzvbYellow,True,RGB(O,Oz255),True.Max=5.HorzSpIits=6.VertSpIits=6.LineType=TYPE_POINTEndWithEndSubPrivateSubForm_Unload(CancelAsInteger)UnloadMeEndSubPrivateSubPicture_line_Paint()1.Drawl.RePaintEndSubPrivateSubPicture_line2_Click()1.Draw2.RePaintEndSubPrivateSubPicture_point_Paint()PDrawl.RePaintEndSubPrivateSubPicture_point2_Click()PDrawl.RePaintEndSubPrivateSubPicturel_Click()PDraw3.RePaintEndSubForm2.frm源码VERSION5.00BeginVB.FormForm2Caption=CIientHeight=CIientLeft=CIientTop=CIientWidth=1.inkTopic=MaxButton:"Form2"3030605104680"Form2"=0'FalseScaIeHeight=3030ScaIeWidth=StartUpPosition=46803'窗口缺省BeginVB.LabelLabel2Caption="火灾报警器数据采集工具V1.0"BeginPropertyFontNameSizeCharsetWeightUnderlineItalic="宋体',=10.5=134=400=0'False=0'FalseStrikethrough=0'FalseEndPropertyHeight1.eftTabindexTopWidthEnd=375=840=1=1680=3375BeginVB.LabelLabellCaption="西安亚川电力科技有限公司UBeginPropertyFontName=”宋体”Size=10.5Charset=134Weight=400Underline=0'FalseItalic=0'FalseStrikethrough=0'FalseEndPropertyHeight=495Left=960Tabindex=0Top=720Width=2535EndEndAttributeVB_Name="Form2"AttributeVB_GlobalNameSpace=FalseAttributeVB_Creatable=FalseAttributeVB_Predeclaredld=TrueAttributeVB_Exposed=FalsefrmAbout.frm源码VERSION5.00BeginVB.FormfrmAboutBorderStyIe=3'FixedDialogCaption=”火灾报警器数据采集工具CIientHeight=3555CIientLeft=2340CIientTop=1935CIientWidth=5730ClipControIs=0'FalseIcon="frmAbout.frx":0000LinkTopic=,Form2"MaxButton=0,FalseMinButton=0'FalseScaIeHeight=2453.724ScaIeMode=0'UserScaIeWidth=5380.766ShowInTaskbar=0'FalseBeginVB1PictureBoxpiclconAutoSize=-1'TrueClipControIs=0'FalseHeight=540Left=240Picture="frmAbout.frx":038AScaIeHeight=ScaIeModeScaIeWidth337.12=O'User=337.12Tabindex=1Top=240WidthEnd=540BeginVB1CommandButtoncmdOKCancel=-1'TrueCaptionDefault=Height1.eft=Tabindex="确定”-1'True=3454125=OTop=2625Width=1500EndBeginVB1CommandButtonCmdSysInfoCaptionHeightLeft=Tabindex="系统信息(&S).”=3454140=2Top=3075Width=1485EndBeginVB.LineLinelBorderCoIor=&H00808080&BorderStyIe=6'InsideSolidIndex=1Xl=84.515X2=5309.398Yl=1687.583Y2End=1687.583BeginVB.LabelIbIDescriptionCaption="本软件是西安亚川电力科技有限公司的火灾报警器数据采集专用软件。UForeCoIor=&H00000000&Height=1170Left=1050Tabindex=3Top=1125Width=3885EndBeginVB.LabelIblTitIeCaption=”西安亚川电力科技有限公司”ForeCoIor=&H00000000&Height=480Left=1050Tablndex=5Top=240Width=3885EndBeginVB.LineLinelBorderCoIor=&HOOFFFFFF&BorderWidth=2Index=OXl=98.6X2=5309.398Yl=1697.936Y2=1697.936EndBeginVB.LabelIbIVersionCaption=”版本1.0"Height=225Left=1050Tabindex=6Top=780Width=3885EndBeginVB.LabelIbIDiscIaimerCaption=”西安亚川电力科技有限公司版权所有”ForeCoIor=&H00000000&Height=825Left=255Tabindex=4Top=2625Width=3630EndEndAttributeVB_Name="frmAbout"AttributeVB_GlobalNameSpace=FalseAttributeVB_Creatable=FalseAttributeVB_Predeclaredld=TrueAttributeVB_Exposed=FalseOptionExplicit,注册表关键字安全选项ConstREAD_CONTROL=&H20000ConstKEY_QUERY_VALUE=&H1ConstKEY_SET_VALUE=&H2ConstKEY_CREATE_SUB_KEY=&H4ConstKEY_ENUMERATE_SUB_KEYS=&H8ConstKEY_NOTIFY=&H10ConstKEY_CREArEjjNK=&H20ConstKEY_ALL_ACCESS=KEY_QUERY_VALUE+KEY_SET_VALUE+_KEY_CREATE_SUB_KEY+KEY_ENUMERATE_SUB_KEYS+_KEY_NOTIFY+KEY_CREATE_LINK+READ_CONTROL,注册表关键字ROOT类型ConstHKEY_LOCAL_MACHINE=&H80000002ConstERROR_SUCCESS=0ConstREG_SZ=1,独立的空的终结字符串ConstREG_DWORD=4,32位数字ConstgREGKEYSYSINFOLOC=,SOFTWAREMicrosoftSharedToolsLocation"ConstgREGVALSYSINFOLOC="MSINFO"ConstgREGKEYSYSINFO="SOFTWAREMicrosoftSharedToolsMSINFO"ConstgREGVALSYSINFO="PATH"PrivateDeclareFunctionRegOpenKeyExLib,advapi32"Alias"RegOpenKeyExA"(ByVaIhKeyAsLong,ByVaIIpSubKeyAsString,ByVaIulptionsAsLong,ByVaISamDesiredAsLong,ByRefphkResultAsLong)AsLongPrivateDeclareFunctionRegQueryVaIueExLib"advapi32"Alias"RegQueryVaIueExA"(ByVaIhKeyAsLong,ByVaIIpVaIueNameAsString,ByVaIIpReservedAsLong,ByRefIpTypeAsLong,ByVaIIpDataAsString,ByRefIpcbDataAsLong)AsLongPrivateDeclareFunctionRegCIoseKeyLib"advapi32"(ByVaIhKeyAsLong)AsLongPrivateSubcmdSyslnfo_Click()CallStartSysInfoEndSubPrivateSubcmdOK_Click()UnloadMeEndSubPrivateSubForm_Load()Me.Caption="关于"&AppJitIeIbIVersion.Caption="版本"&App.Major&"."&App.Minor&"."&App.RevisionIblTitIe-Caption=AppJitIeEndSubPublicSubStartSysInfoOOnErrorGoToSysInfoErrDimrcAsLongDimSysInfoPathAsString'试图从注册表中获得系统信息程序的路径及名称IfGetKeyValue(HKEY_LOCAL_MACHINE,gREGKEYSYSINFOzgREGVALSYSINFO,SysInfoPath)Then'试图仅从注册表中获得系统信息程序的路径ElselfGetKeyValue(HKEY_LOCAL_MACHINE,gREGKEYSYSINFOLOCzgREGVALSYSINFOLOCzSysInfoPath)Then,已知32位文件版本的有效位置If(Dir(SyslnfoPath&"MSINFO32.EXE")<>"',)ThenSysInfoPath=SysInfoPath&"MSINFO32.EXE",错误文件不能被找到.ElseGolbSysInfoErrEndIf,错误注册表相应条目不能被找到ElseGoToSysInfoErrEndIfCallShell(SyslnfoPath,VbNormaIFocus)ExitSubSysInfoErr:MsgBox"此时系统信息不可用",VbOKOnIyEndSubPublicFunctionGetKeyVaIue(KeyRootAsLong,KeyNameAsString,SubKeyRefAsString,ByRefKeyVaIAsString)AsBooleanDimIAsLong,循环计数器DimrcAsLong,返回代码DimhKeyAsLong'打开的注册表关键字句柄注册表关键字数据类型注册表关键字值的临时DimhDepthAsLongDimKeyVaITypeAsLongDimtmpValAsString存储器DimKeyVaISizeAsLong,注册表关键自变量的尺,打开HKEY_LOCAL_MACHINE.下的RegKeyrc=RegOpenKeyExlKeyRoot,KeyName,0,KEY_ALL_ACCESS,hKey)1打开注册表关键字If(rc<>ERROR_SUCCESS)ThenGoToGetKeyError处理错误tmpVal=String$(1024,0)KeyVaISize=1024分配变量空间'标记变量尺寸检索注册表关键字的值.rc=RegQueryVaIueExthKeyzSubKeyRef,0,_KeyVaIType,tmpVal,KeyVaISize)获得/创建关键字值If(rc<>ERROR_SUCCESS)ThenGoToGetKeyErrorIf(Asc(Mid(tmpVal,KeyVaISizez1)=0)Then串tmpVal=Left(tmpVal,KeyVaISize-1)出来Else符串tmpVal=Left(tmpVal,KeyVaISize)串EndIf,处理错误Win95外接程序空终结字符Null被找到,从字符串中分离,WinNT没有空终结字,Null没有被找到,分离字符决定转换的关键字的值类型.SelectCaseKeyVaITypeCaseREG_SZ据类型KeyVaI=tmpValCaseREG_DWORD键字数据类型ForI=LenftmpVaI)To1Step-1KeyVaI=KeyVaI+Hex(Asc(Mid(tmpVal,1,1)NextKeyVaI=Format$("&h"+KeyVaI)串,搜索数据类型.,字符串注册关键字数,友制字符串的值'四字节的注册表关将每位进行转换生成值字符。ByCharo'转换四字节的字符为字符EndSelectGetKeyVaIue=True'返回成功rc=RegCIoseKey(HKey)'关闭注册表关键字ExitFunction,退出GetKeyError:'错误发生后将其清除.KeyVaI=""'设置返回值到空字符串GetKeyVaIue=False'返回失败rc=RegCIoseKey(HKey),关闭注册表关键字EndFunctionfrmBrowser.frm源码VERSION5.00Object="831FDD16-0C5C-llD2-A9FC-0000F8754DAl#2.0#0""MSCOMCTL.OCX"Object="EAB22AC0-30Cl-llCF-A7EB-0000C05BAE0B#l.l#0""shdocvw.dll"BeginVB.FormfrmBrowserCIientHeight=CIientLeft=49653060CIientTop=3510CIientWidth=1.inkTopic=6540"Forml"ScaIeHeight=4965ScaIeWidth=ShowInTaskbar=65400'FalseBeginVB.TimertimTimerEnabledIntervalLeftTopEnd=0'False=5=6180=1500BeginVB1PictureBoxpicAddressAlignBorderStyIeHeightLeftScaIeHeightScaIeWidthTabindexTabStopTop=1'AlignTop=0'None=675=0=675=6540=4=0'False=540Width=6540BeginVB.ComboBoxCboAddressHeightLeftTabindexTextTopWidthEnd=300=45=2="Combol"=300=3795BeginVB.LabelIbIAddressCaptionHeight1.eftTabindexTagTopWidthEndEnd="地址(&A):”=255=45=1="地址(&A):“=60=3075BeginMSComctlLib.ToolbartbT00IBarAlign=1'AlignTopHeight=1.eft=Tabindex=540O3Top=OWidth=6540ExtentX=11536_ExtentY=ButtonWidth=953820ButtonHeight=794Appearance=ImageList=Version=1"imlToolbarlcons"393216BeginPropertyButtons66833FE8-8583-llDl-B16A-00C0F0283628NumButtons=6BeginPropertyButtonl66833FEA-8583-llDl-B16A-00C0F0283628Key="Back"Object.TooITipText="Back"ImageindexEndProperty=1BeginPropertyButton266833FEA-8583-llDl-B16A-00C0F0283628)Key="Forward"Object-TooITipText="Forward"Imageindex=2EndPropertyBeginPropertyButton366833FEA-8583-llDl-B16A-00C0F0283628)Key="Stop"ObjectTooITipText="Stop"Imageindex=3EndPropertyBeginPropertyButton466833FEA-8583-llDl-B16A-00C0F0283628)Key="Refresh"ObjectTooITipText="Refresh"Imageindex=4EndPropertyBeginPropertyButton566833FEA-8583-llDl-B16A-00C0F0283628Key="Home"Object.TooITipText="Home"Imageindex=5EndPropertyBeginPropertyButton666833FEA-8583-llDl-B16A-00C0F0283628)Key="Search"ObjectTooITipText="Search"Imageindex=6EndPropertyEndPropertyEndBeginMSComctlLib.ImageListImlTooIbarIconsLeft=2670Top=2235_ExtentX=1005_ExtentY二1005BackCoIor=-2147483643ImageWidth=24ImageHeight=24MaskCoIor=12632256Version=393216BeginPropertvImages2C247F25-8591-llDl-B16A-00C0F0283628)NumListImages=6BeginPropertyListlmagel2C247F27-8591-llDl-B16A-00C0F0283628Picture="frmBrowser.frx":0000Key=",EndPropertyBeginPropertyListImageZ2C247F27-8591-llDl-B16A-00C0F0283628Picture="frmBrowser.frx":0712Key=",EndPropertyBeginPropertyListlmage32C247F27-8591-llDl-B16A-00C0F0283628"frmBrowser.frx" :0E24PictureKeyEndPropertyBeginPropertyListlmage42C247F27-8591-llDl-B16A-00C0F0283628Picture="frmBrowser.frx":1536Key=",EndPropertyBeginPropertyListlmage52C247F27-8591-llDl-B16A-00C0F0283628Picture="frmBrowser.frx":1C48Key=",EndPropertyBeginPropertyListImageG2C247F27-8591-llDl-B16A-00C0F0283628Picture="frmBrowser.frx":235AKey=",EndPropertyEndPropertyEndBeginSHDocvwCtLWebBrowserbrwWebBrowserHeight=3734Left=50Tabindex=OTop三1215Width5393ExtentX=9513ExtentY=6586ViewMode=OOffline=OSilent=ORegisterAsBrowser=ORegisterAsDropTarget=1AutoArrange=O'FalseNoCIientEdge=O'FalseAIignLeft=O'FalseNoWebView=O,FalseHideFiIeNames=O'FalseSingIeCIick=O'FalseSingIeSeIection=O'FalseNoFoIders=O'FalseTransparent=O'FalseViewID=,0057D0E0-3573-llCF-AE69-08002B2E1262"Location="http:/"EndEndAttributeVBName=,frmBrowser"AttributeVB_GlobalNameSpace=FalseAttributeVB_Creatable=FalseAttributeVB_Predeclaredld=TrueAttributeVB_Exposed=FalsePublicStartingAddressAsStringDimmbDontNavigateNowAsBooleanPrivateSubForm_Load()OnErrorResumeNextMe.ShowtbTolBar.RefreshForm_ResizecboAddress.Move50zIbIAddress.Top+IbIAddress.Height+15IfLen(StartingAddress)>OThencboAddress.Text=StartingAddressCboAddress.AddItemCboAddressJext'尝试定位到起始地址timTimer.Enabled=TruebrwWebBrowser.NavigateStartingAddressEndIfEndSubPrivateSubbrwWebBrowser_DownloadComplete()OnErrorResumeNextMe.Caption=brwWebBrowser.LocationNameEndSubPrivateSubbrwWebBrowser_NaVigateCompIete2(ByVaIpDispAsObject,URLAsVariant)OnErrorResumeNextDimIAsIntegerDimbFoundAsBooleanMe.Caption=brwWebBrowser.LocationNameForI=OToCboAddress.UstCount-1IfCboAddresslist(I)=brwWebBrowser.LocationURLThenbFound=TrueExitForEndIfNextImbDontNavigateNow=TrueIfbFoundThenCboAddress.RemoveitemIEndIfcboAddress.AddltembrwWebBrowser.LocatioURL,OCboAddress.UstIndex=OmbDontNavigateNow=FalseEndSubPrivateSubcboAddress_Click()IfmbDontNavigateNowThenExitSubtimTimer.Enabled=TruebrwWebBrowser.NavigateCboAddressJextEndSubPrivateSubcboAddress_KeyPress(KeyAsciiAsInteger)OnErrorResumeNextIfKeyAscii=VbKeyReturnThencboAddress_ClickEndIfEndSubPrivateSubForm_Resize()OnErrorResumeNextcboAddress.Width=Me1ScaIeWidth-100brwWebBrowser.Width=Me-ScaIeWidth-100brwWebBrowser.Height=Me-ScaIeHeight-(picAddress.7bp+picAddress.Height)-100EndSubPrivateSubtimTimer_Timer()IfbrwWebBrowser.Busy=FalseThentimTimer.Enabled=FalseMe.Caption=brwWebBrowser.LocationNameElseMe.Caption="Working."EndIfPrivateSubtbToolBar_ButtonClick(ByValButtonAsButton)OnErrorResumeNexttimTimer.Enabled=TrueSelectCaseButton.KeyCase"Back"brwWebBrowser.GoBackCase"Forward',brwWebBrowser.GoForwardCase"Refresh"brwWebBrowser.RefreshCase"Home"brwWebBrowser.GoHomeCase"Search"brwWebBrowser.GoSearchCase"Stop"timTimer.Enabled=FalsebrwWebBrowser.StopMe.Caption=brwWebBrowser.LocationNameEndSelectEndSubfrmMain.frm源码VERSION5.00Object="F9043C88-F6F2-101A-A3C9-08002B2F49FB#1.2#0",'COMDLG32.OCX"Object="831FDD16-0C5C-llD2-A9FC-0000F8754DAl#2.0#0""MSCOMCTL.OCX"Object="5E9E78A0-531B-llCF-91F6-C2863C385E30#1.0#0",MSFLXGRD.OCX"Object="648A5603-