《串口曲线接收程序.docx》由会员分享,可在线阅读,更多相关《串口曲线接收程序.docx(106页珍藏版)》请在课桌文档上搜索。
1、Forml.frm源码VERSION5.00BeginVB.FormFormlBorderStyIe=1FixedSingleCaption=”实时曲线”CIientHeight=6690CIientLeft=45CIientTop=495CIientWidth=9840Icon=Forml.frx:0000LinkTopic=FormlMaxButton=OFalseMinButton=OFalseScaIeHeight=6690ScaIeWidth=9840StartUpPosition:3,窗口缺省BeginVB1PictureBoxPicturelAutoRedraw=-1TrueBa
2、ckCoIor=&H80000012&Height=2175Left=120ScaIeHeight=2115ScaIeWidth=9585Tabindex=4Top=120Width=9650EndBeginVB1PictureBoxPictureJineAutoRedraw=-1TrueBackCoIor=&H80000012&Height=2145Left=120ScaIeHeight=2085ScaIeWidth=4785Tabindex=3Top=2280Width=4845EndBeginVB-PictureBoxPicture_pointAutoRedraw=-1TrueBackC
3、oIor=&H80000012&Height=2145Left=120ScaIeHeight=2085ScaIeWidth=4785Tabindex=2Top=4440Width=4845EndBeginVB1PictureBoxPicturejine2AutoRedraw=-1TrueBackCoIor=&H80000012&Height=2145Left=4920ScaIeHeight=2085ScaIeWidth=4785Tabindex=1Top=2280Width=4845EndBeginVB1PictureBoxPicture_point2AutoRedraw=-1TrueBack
4、CoIor=&H80000012&Height=2145Left=4920ScaIeHeight=2085ScaIeWidth=4785Tabindex二OTop三4440Width=4845EndEndAttributeVB_Name=,FormlAttributeVB_GlobalNameSpace=FalseAttributeVB_Creatable=FalseAttributeVB_Predeclaredld=TrueAttributeVB_Exposed=FalseOptionExplicitPrivateSubForm_Load()WithLDrawl.InitDrawLinePi
5、ctureJine,vbRed,True.Max=5.HorzSpIits=6.VertSpIits=6.LineType=TYPE-LINE.RePaintEndWithWithPDrawl.InitDrawLinePicturjpoint,VbRed,True.Max=5.HorzSpIits=6.VertSpIits=6.LineType=TYPE-POINT.RePaintEndWithWithLDraw2.InitDrawLinePictureJineZ,vbRed,True.Max=5.HorzSpIits=6.VertSpIits=6.LineType=TYPE-LINE.ReP
6、aintEndWithWithPDraw2.InitDrawLinePicture-point2,VbRed,True.Max=5.HorzSpIits=6.VertSpIits=6.LineType=TYPE-POINT.RePaintEndWithWithPDraw3.InitDrawLinePicturelzVbYeIIowzTrue,RGB(OzO,255)zTrue.Max=5.HorzSpIits=6.VertSpIits=6.LineType=TYPE-POINTEndWithEndSubPrivateSubForm_Unload(CancelAsInteger)UnloadMe
7、EndSubPrivateSubPicture_line_Paint()1.Drawl1RePaintEndSubPrivateSubPicture_line2_Click()1.Draw2.RePaintEndSubPrivateSubPicture_point_Paint()PDrawl.RePaintEndSubPrivateSubPicture_point2_Click()PDrawl.RePaintEndSubPrivateSubPicturel_Click()PDraw3.RePaintEndSubForm2.frm源码VERSION5.00BeginVB.FormForm2Cap
8、tion=,Form2CIientHeight=3030CIientLeft=60CIientTop=510CIientWidth=4680LinkTopic=Form2MaxButton=0FalseScaIeHeight=3030ScaIeWidth=4680StartUpPosition=3,窗口缺省BeginVB.LabelLabel2Caption=火灾报警器数据采集工具VLO1BeginPropertyFontName=宋体,,Size=10.5Charset=134Weight=400Underline=0FalseItalic=0FalseStrikethrough=0Fals
9、eEndPropertyHeight=375Left=840Tabindex=1Top=1680Width=3375End“西安亚川电力科技有限公司”BeginVB.LabelLabellCaptionBeginPropertyFontName=”宋体”Size=10.5Charset=134Weight=400Underline=0FalseItalic=0FalseStrikethrough=0FalseEndPropertyHeight=495Left=960Tabindex=0Top=720Width=2535EndEndAttributeVB_Name=Form2AttributeV
10、B_GlobalNameSpace=FalseAttributeVB_Creatable=FalseAttributeVB_Predeclaredld=TrueAttributeVB_Exposed=FalsefrmAbout.frm源码VERSION5.00BeginVB.FormfrmAboutBorderStyIe=3FixedDialogCaption=“火灾报警器数据采集工具CIientHeight=3555CIientLeft=2340CIientTop=1935CIientWidth=5730ClipControIs=0FalseIcon=,frmAbout.frx:0000Li
11、nkTopic=Form2MaxButton=0FalseMinButton=0FalseScaIeHeight=2453.724ScaIeMode=0UserScaIeWidth=5380.766ShowInTaskbar=0FalseBeginVB-PictureBoxpiclconAutoSize=-1TrueClipControIs=0FalseHeight=540Left=240Picture=frmAbout.frx:038AScaIeHeight=337.12ScaIeMode=OUserScaIeWidth=337.12Tabindex=1Top=240Width=540End
12、BeginVB1CommandButtoncmdOKCancel三-1TrueCaption=“确定,,Default=-1TrueHeight=345Left=4125Tabindex=OTop=2625Width=1500EndBeginVB-CommandButtonCmdSysInfoCaption=”系统信息(&S).”Height=345Left=4140Tabindex=2Top=3075Width=1485EndBeginVB.LineLinelBorderCoIor=&H00808080&BorderStyIe=6InsideSolidIndex=1Xl=84.515X2=5
13、309.398Yl=1687.583Y2三1687.583EndBeginVB.LabelIbIDescriptionCaption=”本软件是西安亚川电力科技有限公司的火灾报警器数据采集专用软件。ForeCoIor=&H00000000&Height=1170Left=1050Tabindex=3Top=1125Width=EndBeginVB.LabelIbITitIeCaption=ForeCoIor=Height=1.eft=Tabindex=3885”西安亚川电力科技有限公司”&H00000000&48010505Top=Width=End2403885BeginVB.LineLin
14、elBorderCoIor=BorderWidth=Index=&HOOFFFFFF&2OXl=98.6X2=5309.398Yl=1697.936Y2=EndBeginVB.LabelIbIVersionCaption=Height=1.eft=Tabindex=1697.936,版本1.022510506Top=Width=End7803885BeginVB.LabelIblDiscIaimerCaption=ForeCoIor=Height=1.eft=Tabindex=”西安亚川电力科技有限公司版权所有”&H00000000&8252554Top=Width=EndEnd2625363
15、0AttributeVB_Name=frmAboutAttributeVB_GlobalNameSpace=FalseAttributeVB_Creatable=FalseAttributeVB-Predeclaredld=TrueAttributeVB_Exposed=FalseOptionExplicit,注册表关键字安全选项ConstREAD_CONTROL=&H20000ConstKEY_QUERY_VALUE=&H1ConstKEY_SET_VALUE=&H2ConstKEY_CREATE_SUB_KEY=&H4ConstKEY_ENUMERATE_SUB_KEYS=&H8Const
16、KEY_NOTIFY=&H10ConstKEY_CREATE_LINK=&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=432位数字ConstgREGKEYSYSI
17、NFOLOC=SOFTWAREMicrosoftSharedToolsLocationConstgREGVALSYSINFOLOC=MSINFOConstgREGKEYSYSINFO=SOFTWAREMicrosoftSharedToolsMSINFOConstgREGVALSYSINFO=PATHPrivateDeclareFunctionRegOpenKeyExLib,advapi32AliasRegOpenKeyExA(ByVaIhKeyAsLong,ByVaIIpSubKeyAsString,ByVaIUlOptionsAsLong,ByVaISamDesiredAsLong,ByRe
18、fPhkResuItAsLong)AsLongPrivateDeclareFunctionRegQueryVaIueExLibadvapi32AliasRegQueryVaIueExA(ByVaIhKeyAsLong,ByVaIIpVaIueNameAsString,ByVaIIpReservedAsLong,ByRefIpTypeAsLong,ByVaIIpDataAsString,ByRefIpcbDataAsLong)AsLongPrivateDeclareFunctionRegCIoseKeyLibadvapi32(ByVaIhKeyAsLong)AsLongPrivateSubcmd
19、Syslnfo_Click()CallStartSysInfoEndSubPrivateSubcmdOK_Click()UnloadMeEndSubPrivateSubForm_Load()Me.Caption=关于&App.TitleIblVersion.Caption=版本&App.Major&.&App.Minor&.&App1RevisionIblTitIe-Caption=AppJitIeEndSubPublicSubStartSysInfoOOnErrorGoToSysInfoErrDimrcAsLongDimSysInfoPathAsString,试图从注册表中获得系统信息程序的
20、路径及名称.IfGetKeyVaIUe(HKEY_LOCAL_MACHINE,gREGKEYSYSINF0,gREGVALSYSINFO,SysInfoPath)Then试图仅从注册表中获得系统信息程序的路径.ElselfGetKeyValue(HKEY-LOCAL-MACHINE,gREGKEYSYSINFOLOC,gREGVALSYSINFOLOC,SysInfoPath)Then,已知32位文件版本的有效位置If(Dir(SyslnfoPath&MSINFO32.EXE),)ThenSysInfoPath=SysInfoPath&MSINFO32.EXE,错误文件不能被找到ElseGoT
21、oSysInfoErrEndIf错误-注册表相应条目不能被找到ElseGolbSysInfoErrEndIfCallShell(SyslnfoPath,VbNormaIFocus)ExitSubSysInfoErr:MsgBox此时系统信息不可用,VbOKOnIyEndSubPublicFunctionGetKeyValue(KeyRootAsLong,KeyNameAsString,SubKeyRefAsString,ByRefKeyVaIAsString)AsBooleanDimIAsLong,循环计数器DimrcAsLong返回代码DimhKeyAsLong打开的注册表关键字句柄Dimh
22、DepthAsLong,注册表关键字数据类型,注册表关键字值的临时DimKeyVaITypeAsLongDimtmpValAsString存储器DimKeyVaISizeAsLong寸注册表关键自变量的尺打开HKEY_LOCAL_MACHINE.下的RegKeyrc=RegOpenKeyExlKeyRoot,KeyNamez0,KEY_ALL_ACCESS,hKey)打开注册表关键字If(rcERROR_SUCCESS)ThenGoToGetKeyError处理错误tmpVal=StringS(1024,0)分配变量空间KeyVaISize=1024标记变量尺寸检索注册表关键字的值rc=Reg
23、QUeryValUeEX(hKey,SubKeyRefz0,_KeyVaITypeztmpVal,KeyVaISize)获得/创建关键字值If(rcERROR_SUCCESS)ThenGoToGetKeyErrorIf(Asc(Mid(tmpValzKeyVaISizez1)=0)Then串.tmpVal=Left(tmpValzKeyVaISize-1)出来Else符串tmpVal=Left(tmpVal,KeyVaISize)串EndIf决定转换的关键字的值类型SelectCaseKeyVaITypeCaseREG_SZ据类型KeyVaI=tmpValCaseREG_DWORD键字数据类型
24、ForI=Len(tmpVal)To1Step-1KeyVaI=KeyVaI+Hex(Asc(Mid(tmpVal,1,1)Next,处理错误,Win95外接程序空终结字符,Null被找到,从字符串中分离,WinNT没有空终结字,Null没有被找到,分离字符,搜索数据类型,字符串注册关键字数,复制字符串的值,四字节的注册表关将每位进行转换生成值字符。ByCharoKeyVaI=Format$(&h+KeyVaI)转换四字节的字符为字符返回成功关闭注册表关键字 退出,设置返回值到空字符返回失败关闭注册表关键字EndSelectGetKeyVaIue=Truerc=RegCIoseKey(KKey
25、)ExitFunctionGetKeyError:错误发生后将其清除.KeyVaI=|,串GetKeyVaIue=Falserc=RegCIoseKey(KKey)EndFunctionfrmBrowsenfrm源码VERSION5.00Object=831FDD16-0C5C-llD2-A9FC-0000F8754DAl#2.0#0;MSCOMCTL.OCXObject=EAB22AC0-30Cl-llCF-A7EB-0000C05BAE0B#l.l#0;shdocvw.dllBeginVB.FormfrmBrowserCIientHeight=4965CIientLeft=3060CIie
26、ntTop=3510CIientWidth=65401.inkTopic=FormlScaIeHeight=4965ScaIeWidth=6540ShowInTaskbar=0FalseBeginVB.TimertimTimerEnabled=0FalseInterval1.eftTopEnd=5=6180=1500BeginVB-PictureBoxpicAddressAlignBorderStyIeHeight1.eftScaIeHeightScaIeWidthTabindexTabStopTop=1AlignTop=0None=675=0=675=6540=4=0False=540Wid
27、th=6540BeginVB.ComboBoxCboAddressHeightLeftTabindexTextTopWidthEnd=300=45=2=Combol=300=3795BeginVB.LabelIblAddressCaptionHeightLeftTabindexTagTopWidthEndEnd=地址(&A):”=255=45=1=地址(&A):“=60=3075BeginMSComctILib.ToolbartbT00IBarAlign=Height=1.eft=Tabindex=Top=Width=_ExtentX=ExtentY=1AlignTop540O3O654011
28、536953ButtonWidth=820ButtonHeight=794Appearance=ImageList=Version=1imlToolbarlcons393216BeginPropertyButtons66833FE8-8583-llDl-B16A-00C0F0283628NumButtons=6BeginPropertyButtonl66833FEA-8583-llDl-B16A-00C0F0283628Key=BackObjectJooITipText=BackImageindexEndProperty=1BeginPropertyButton266833FEA-8583-l
29、lDl-B16A-00C0F0283628Key=ForwardObject-TooITipText=ForwardImageindex=2EndPropertyBeginPropertyButton366833FEA-8583-llDl-B16A-00C0F0283628Key=StopObject.TooITipText=StopImageindex=3EndPropertyBeginPropertyButton466833FEA-8583-llDl-B16A-00C0F0283628Key=RefreshObject.TooITiplext=RefreshImageindex=4EndP
30、ropertyBeginPropertyButtonS66833FEA-8583-llDl-B16A-00C0F0283628Key=HomeObjectjooITiplext=HomeImageindex=5EndPropertyBeginPropertyButto666833FEA-8583-llDl-B16A-00C0F0283628Key=SearchObject-TooITipText=SearchImageindex=6EndPropertyEndPropertyEndBeginMSComctlLib.ImageListImlTooIbarIconsLeft=Top=_Extent
31、X=ExtentY=2670223510051005BackCoIor=-2147483643ImageWidth=24ImageHeight=MaskCoIor=Version=2412632256393216BeginPropertyImages2C247F25-8591-llDl-B16A-00C0F0283628NumListImages=6BeginPropertyListlmagel2C247F27-8591-llDl-B16A-00C0F0283628PictureKeyEndProperty=frmBrowser.frx:0000IlllBeginPropertyListlma
32、ge22C247F27-8591-llDl-B16A-00C0F0283628PictureKeyEndProperty=frmBrowsenfrx:0712IlllBeginPropertyListlmage32C247F27-8591-llDl-B16A-00C0F0283628Picture=frmBrowser.frx:0E24Key=EndPropertyBeginPropertyListlmage42C247F27-8591-llDl-B16A-00C0F0283628Picture=frmBrowser.frx:1536Key=EndPropertyBeginPropertyLi
33、stlmage52C247F27-8591-llDl-B16A-00C0F0283628Picture=frmBrowser.frx:1C48Key=EndPropertyBeginPropertyListImageG2C247F27-8591-llDl-B16A-00C0F0283628Picture=frmBrowser.frx:235AKey=EndPropertyEndPropertyEndBeginSHDocvwCtLWebBrowserbrwWebBrowserHeight=3734Left=50Tabindex=OTop=1215Width=5393ExtentX=9513Ext
34、entY=6586ViewMode=OOffline=OSilent=ORegisterAsBrowser=ORegisterAsDropTarget=1AutoArrange=OFalseNoCIientEdge=OFalseAIignLeft=OFalseNoWebView=OFalseHideFiIeNames=OFalseSingIeCIick=OFalseSingIeSeIection=OFalseNoFoIders=OFalseTransparent=OFalseViewID=,0057D0E0-3573-llCF-AE69-08002B2E1262Location=http:/E
35、ndEndAttributeVBName=frmBrowserAttributeVB_GlobalNameSpace=FalseAttributeVB_Creatable=FalseAttributeVB_Predeclaredld=TrueAttributeVB_Exposed=FalsePublicStartingAddressAsStringDimmbDontNavigateNowAsBooleanPrivateSubForm_Load()OnErrorResumeNextMe.ShowtbToolBar.RefreshForm_ResizecboAddress.Move50,IbIAd
36、dressTop+IbIAddress-Height+15IfLen(StartingAddress)OThenCboAddress,Text=StartingAddressCboAddress-AddItemcboAddress.Text尝试定位到起始地址timTimer.Enabled=TruebrwWebBrowser.NavigateStartingAddressEndIfEndSubPrivateSubbrwWebBrowser_DownloadComplete()OnErrorResumeNextMe.Caption=brwWebBrowser.LocatioNameEndSubP
37、rivateSubbrwWebBrowser_NavigateComplete2(ByValpDispAsObject,URLAsVariant)OnErrorResumeNextDimIAsIntegerDimbFoundAsBooleanMe.Caption=brwWebBrowser.LocationNameForI=OToCboAddresslistCount-1IfcboAddresslist(I)=brwWebBrowser.LocationURLThenbFound=TrueExitForEndIfNextImbDontNavigateNow=TrueIfbFoundThenCb
38、oAddress.RemoveItemIEndIfCboAddress-AddItembrwWebBrowser.LocationURL,OCboAddress.UstIndex=OmbDontNavigateNow=FalseEndSubPrivateSubcboAddress_Click()IfmbDontNavigateNowThenExitSubtimTimer.Enabled=TruebrwWebBrowser.NavigateCboAddressJextEndSubPrivateSubcboAddress_KeyPress(KeyAsciiAsInteger)OnErrorResu
39、meNextIfKeyAscii=VbKeyReturnThencboAddress_ClickEndIfEndSubPrivateSubForm_Resize()OnErrorResumeNextCboAddress.Width=Me1ScaIeWidth-100brwWebBrowser.Width=Me-ScaIeWidth-100brwWebBrowser.Height=Me-ScaIeHeight-(picAddress.Top+picAddress.Height)-100EndSubPrivateSubtimTimer_Timer()IfbrwWebBrowser.Busy=Fal
40、seThentimTimer.Enabled=FalseMe.Caption=brwWebBrowser.LocationNameElseMe.Caption=Working.EndIfPrivateSubtbToolBar_ButtonClick(ByValButtonAsButton)OnErrorResumeNexttimTimer.Enabled=TrueSelectCaseButton.KeyCaseBackbrwWebBrowser.GoBackCaseForwardbrwWebBrowser.GoForwardCaseRefreshbrwWebBrowser.RefreshCas
41、eHomebrwWebBrowser.GoHomeCaseSearchbrwWebBrowser.GoSearchCaseStoptimTimer.Enabled=FalsebrwWebBrowser.StopMe.Caption=brwWebBrowser.LocationNameEndSelectEndSubfrmMain.frm源码VERSION5.00Object=F9043C88-F6F2-101A-A3C9-08002B2F49FB#1.2#0;,COMDLG32.OCXObject=831FDD16-0C5C-llD2-A9FC-0000F8754DAl#2.0#0;MSCOMCTLOCXObject=5E9E78A0-531B-llCF-91F6-C2863C385E30#1.0#0;,MSFLXGRD.OCXObject=648A5603-2C6E-10