Public Sub Main()
Dim wndplacement As WINDOWPLACEMENT
Dim hwnd As Long
Dim i As Integer, bbb As Integer, j As Integer
Dim temp As Byte, cnt1 As Integer
Dim filen As Byte
Dim GetNetString As String, ReadNetString As String
On Error GoTo ErrH
If Right(App.Path, 1) <> "\" Then
sPath = App.Path & "\"
Else
sPath = App.Path
End If
hwnd = FindWindow(vbNullString, "现场测试软件")
If hwnd <> 0 Then
wndplacement.length = 22
GetWindowPlacement hwnd, wndplacement
If wndplacement.showCmd = SW_SHOWMINIMIZED Then
wndplacement.showCmd = SW_RESTORE
SetWindowPlacement hwnd, wndplacement
SetActiveWindow hwnd
Else
SetActiveWindow hwnd
AppActivate "GPRS监控终端现场测试软件"
End If
End
Else
Comport = Val(ReadInifile(sPath & "GPRSTest.ini", "系统设置", "port"))
Baud = Val(ReadInifile(sPath & "GPRSTest.ini", "系统设置", "baud"))
If Comport = 0 Or Comport > 16 Then Comport = 1
If Baud = 0 Or Baud > 115200 Then Baud = 1200
GprsNameStr = ReadInifile(sPath & "GPRSTest.ini", "终端", "name")
GprsNameStr = Left(GprsNameStr, Len(GprsNameStr) - 1)
GprsAddrStr = ReadInifile(sPath & "GPRSTest.ini", "终端", "addr")
GprsAddrStr = Left(GprsAddrStr, Len(GprsAddrStr) - 1)
APNStr = ReadInifile(sPath & "GPRSTest.ini", "终端", "apn")
APNStr = Left(APNStr, Len(APNStr) - 1)
IPStr = ReadInifile(sPath & "GPRSTest.ini", "终端", "ip")
IPStr = Left(IPStr, Len(IPStr) - 1)
UserStr = ReadInifile(sPath & "GPRSTest.ini", "终端", "user")
UserStr = Left(UserStr, Len(UserStr) - 1)
PassStr = ReadInifile(sPath & "GPRSTest.ini", "终端", "password")
PassStr = Left(PassStr, Len(PassStr) - 1)
PortStr = ReadInifile(sPath & "GPRSTest.ini", "终端", "portnum")
PortStr = Left(PortStr, Len(PortStr) - 1)
Dim temphgq As String
Dim CTLen As Integer, pos As Integer
MeterNum = Val(ReadInifile(sPath & "GPRSTest.ini", "电表", "num"))
For i = 0 To MeterNum - 1
DBPara(i, 0) = ReadInifile(sPath & "GPRSTest.ini", "电表", "b[" & CStr(i) & "]")
DBPara(i, 0) = Left(DBPara(i, 0), Len(DBPara(i, 0)) - 1)
DBPara(i, 1) = ReadInifile(sPath & "GPRSTest.ini", "电表", "c[" & CStr(i) & "]")
DBPara(i, 1) = Left(DBPara(i, 1), Len(DBPara(i, 1)) - 1)
DBPara(i, 2) = ReadInifile(sPath & "GPRSTest.ini", "电表", "d[" & CStr(i) & "]")
DBPara(i, 2) = Left(DBPara(i, 2), Len(DBPara(i, 2)) - 1)
DBPara(i, 3) = ReadInifile(sPath & "GPRSTest.ini", "电表", "e[" & CStr(i) & "]")
DBPara(i, 3) = Left(DBPara(i, 3), Len(DBPara(i, 3)) - 1)
If DBPara(i, 1) = "电表" Then
If DBPara(i, 3) <> "" Then
temphgq = DBPara(i, 3)
If temphgq <> "" Then
CTLen = Len(temphgq)
pos = InStr(temphgq, "/")
RatioInt(dbrcnt, 0) = Val(Left(temphgq, pos - 1))
RatioInt(dbrcnt, 1) = Val(Right(temphgq, CTLen - pos))
If RatioInt(dbrcnt, 1) = 0 Then RatioInt(dbrcnt, 1) = 1
Else
RatioInt(dbrcnt, 0) = 1
RatioInt(dbrcnt, 1) = 1
End If
Else
RatioInt(dbrcnt, 0) = 1
RatioInt(dbrcnt, 1) = 1
End If
dbrcnt = dbrcnt + 1
End If
Next
Load frmMain
End If
Exit Sub
ErrH:
MsgBox Err.Description, vbOKOnly + vbExclamation, "错误提示!"
End Sub[b]哪位能给我把这个程序解释一下,实现的功能是什么?谢谢![/b]
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货