⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 glbf.bas

📁 gps 源码 vb+access 其他地方很难找到 很详细的说明
💻 BAS
📖 第 1 页 / 共 2 页
字号:
    temp_sz = ""
    StopBit = ""
    lll = GetPrivateProfileString("Comm4", "StopBit", "1", temp_sz, "10", "c:\gps\system\Gps,ini")
    For i = 1 To Len(Trim(temp_sz))
        If Asc(Mid(Trim(temp_sz), i, 1)) <> 0 Then
           StopBit = StopBit + Mid(temp_sz, i, 1)
        End If
    Next
    temp_sz = ""
    DataBit = ""
    lll = GetPrivateProfileString("Comm4", "DataBit", "8", temp_sz, "10", "c:\gps\system\Gps,ini")
    For i = 1 To Len(Trim(temp_sz))
        If Asc(Mid(Trim(temp_sz), i, 1)) <> 0 Then
           DataBit = DataBit + Mid(temp_sz, i, 1)
        End If
    Next
    temp_sz = ""
    parity = ""
    lll = GetPrivateProfileString("Comm4", "Parity", "N", temp_sz, "10", "c:\gps\system\Gps.ini")
    For i = 1 To Len(Trim(temp_sz))
        If Asc(Mid(Trim(temp_sz), i, 1)) <> 0 Then
           parity = parity + Mid(temp_sz, i, 1)
        End If
    Next
End Sub

Public Sub Ini_SaveComm4Setting(ByVal Port As Integer, ByVal Baud As String, ByVal parity As String, ByVal DataBit As String, ByVal StopBit As String)
    Dim lll As Long
    lll = WritePrivateProfileString("Comm4", "Port", CStr(Port), "c:\gps\system\Gps.ini")
    lll = WritePrivateProfileString("Comm4", "Baud", Baud, "c:\gps\system\Gps.ini")
    lll = WritePrivateProfileString("Comm4", "StopBit", StopBit, "c:\gps\system\Gps.ini")
    lll = WritePrivateProfileString("Comm4", "DataBit", DataBit, "c:\gps\system\Gps.ini")
    lll = WritePrivateProfileString("Comm4", "Parity", parity, "c:\gps\system\Gps.ini")
End Sub
Public Function Ini_Road() As Integer
    Dim lll As Long
    Dim temp_sz As String * 10
    lll = GetPrivateProfileString("Lock", "LockRoad", "100", temp_sz, "10", "c:\gps\system\Gps.ini")
    Ini_Road = CLng(temp_sz)
End Function

Public Sub Ini_Road_Save(ByVal temp_road As Long)
    Dim lll As Long
    lll = WritePrivateProfileString("Lock", "LockRoad", CStr(temp_road), "c:\gps\system\Gps.ini")
End Sub

Public Function Ini_Lock() As Long
    Dim lll As Long
    Dim temp_sz As String * 10
    lll = GetPrivateProfileString("Lock", "Locklong", "100", temp_sz, "10", "c:\gps\system\Gps.ini")
    Ini_Lock = CLng(temp_sz)
End Function

Public Sub Ini_Lock_Save(ByVal How_Long As Long)
    Dim lll As Long
    lll = WritePrivateProfileString("Lock", "Locklong", CStr(How_Long), "c:\gps\system\Gps.ini")
End Sub

Public Function Ini_LockFlag() As Integer
    Dim lll As Long
    Dim temp_sz As String * 10
    lll = GetPrivateProfileString("Lock", "LockFlag", "100", temp_sz, "10", "c:\gps\system\Gps.ini")
    Ini_LockFlag = CLng(temp_sz)
    
    
End Function

Public Function Ini_LockFlag_Save()
    Dim lll As Long
    If Temp_Lock_Flag = True Then
        lll = WritePrivateProfileString("Lock", "LockFlag", "1", "c:\gps\system\Gps.ini")
    Else
        lll = WritePrivateProfileString("Lock", "LockFlag", "0", "c:\gps\system\Gps.ini")
    End If
End Function


Public Function Ini_IP() As String
    Dim lll As Long
    Dim i As Integer
    Dim temp_sz As String * 20
    lll = GetPrivateProfileString("NetWork", "IP_Addr", "168.8.8.11", temp_sz, "20", "c:\gps\system\Gps.ini")
    For i = 1 To Len(Trim(temp_sz))
        If Asc(Mid(Trim(temp_sz), i, 1)) <> 0 Then
           Ini_IP = Ini_IP + Mid(temp_sz, i, 1)
        End If
    Next
End Function

Public Function Ini_IP_Save(ByVal temp_IP As String)
    Dim lll As Long
    lll = WritePrivateProfileString("NetWork", "IP_Addr", temp_IP, "c:\gps\system\Gps.ini")
End Function

Public Function Ini_GetTargetLegend() As String
    Ini_GetTargetLegend = GetSetting("Gps", "Option", "TargetLegend", "TargetLegend")
End Function
Public Sub Ini_SaveTargetLegend(ByVal strTargetLegend As String)
    SaveSetting "Gps", "Option", "TargetLegend", strTargetLegend
End Sub
Public Function Ini_GetTargetLegendColor() As Long
    Ini_GetTargetLegendColor = GetSetting("Gps", "Option", "TargetLegendColor", 0)
End Function
Public Sub Ini_SaveTargetLegendColor(ByVal lTargetLegendColor As Long)
    SaveSetting "Gps", "Option", "TargetLegendColor", lTargetLegendColor
End Sub

Public Function Ini_GetTargetTrackLegend() As String
    Ini_GetTargetTrackLegend = GetSetting("Gps", "Option", "TargetTrackLegend", "TargetTrackLegend")
End Function
Public Sub Ini_SaveTargetTrackLegend(ByVal strTargetTrackLegend As String)
    SaveSetting "Gps", "Option", "TargetTrackLegend", strTargetTrackLegend
End Sub
Public Function Ini_GetTargetTrackLegendColor() As Long
    Ini_GetTargetTrackLegendColor = GetSetting("Gps", "Option", "TargetTrackLegendColor", 0)
End Function
Public Sub Ini_SaveTargetTrackLegendColor(ByVal lTargetTrackLegendColor As Long)
    SaveSetting "Gps", "Option", "TargetTrackLegendColor", lTargetTrackLegendColor
End Sub

Public Function Ini_GetTargetLockedLegend() As String
    Ini_GetTargetLockedLegend = GetSetting("Gps", "Option", "TargetLockedLegend", "TargetLockedLegend")
End Function
Public Sub Ini_SaveTargetLockedLegend(ByVal strTargetLockedLegend As String)
    SaveSetting "Gps", "Option", "TargetLockedLegend", strTargetLockedLegend
End Sub
Public Function Ini_GetTargetLockedLegendColor() As Long
    Ini_GetTargetLockedLegendColor = GetSetting("Gps", "Option", "TargetLockedLegendColor", 0)
End Function
Public Sub Ini_SaveTargetLockedLegendColor(ByVal lTargetLockedLegendColor As Long)
    SaveSetting "Gps", "Option", "TargetLockedLegendColor", lTargetLockedLegendColor
End Sub

Public Function Ini_GetTargetNameColor() As Long
    Ini_GetTargetNameColor = GetSetting("Gps", "Option", "TargetNameColor", 0)
End Function
Public Sub Ini_SaveTargetNameColor(ByVal lTargetNameColor As Long)
    SaveSetting "Gps", "Option", "TargetNameColor", lTargetNameColor
End Sub

'----------------------读写系统注册信息------------------------------



Public Function Distance(ByVal x1 As Double, ByVal y1 As Double, ByVal x2 As Double, ByVal y2 As Double) As Double
    On Error GoTo err
    Dim oShape1 As New ShapePoint, oShape2 As New ShapePoint
    oShape1.X = x1
    oShape1.Y = y1
    oShape2.X = x2
    oShape2.Y = y2
    Distance = MonitorForm.oCompoundMap.Distance(oShape1, oShape2)
    Exit Function
err:
    Distance = 0
End Function
Public Function Angle(ByVal x1 As Double, ByVal y1 As Double, ByVal x2 As Double, ByVal y2 As Double, ByRef fAngle As Double) As Boolean
    Dim angleTmp As Double
    If x1 <> x2 Then
        angleTmp = Atn(Abs((y2 - y1) / (x2 - x1)))
    End If
    
    If x1 = x2 Then
        If y2 > y1 Then
            fAngle = pi / 2
        Else
            fAngle = pi * 3 / 2
        End If
    ElseIf x2 > x1 Then
        If y2 >= y1 Then ' 1
            fAngle = angleTmp
        Else '4
            fAngle = 2 * pi - angleTmp
        End If
    Else
        If y2 >= y1 Then ' 2
            fAngle = pi - angleTmp
        Else '3
            fAngle = pi + angleTmp
        End If
    End If
        
    
    ' adjust from radius to degree
    fAngle = fAngle / pi * 180
    Angle = True
End Function

Public Function IsLoaded(ByVal strName As String) As Boolean
    Dim i As Integer
    For i = 0 To Forms.Count - 1
        If UCase(Forms(i).Name) = UCase(strName) Then
            IsLoaded = True
            Exit Function
        End If
    Next
End Function

Public Sub Temp_Back()
Dim filename As String
Dim lll As Long
If Dir("c:\gps\sytem", vbDirectory) = "" Then
   MkDir ("c:\gps\sytem")
End If

filename = "c:\gps\system\Gps.ini"
lll = WritePrivateProfileString("Gps", "MDBPath", "c:\gps\system\", filename)
lll = WritePrivateProfileString("MapInfo", "MapName_xdb", "c:\gps\system\hn.xdb", filename)
lll = WritePrivateProfileString("MapInfo", "MapName_fh", "henanshengqt", filename)
lll = WritePrivateProfileString("Comm1", "Port", "1", filename)
lll = WritePrivateProfileString("Comm1", "Baud", "19200", filename)
lll = WritePrivateProfileString("Comm1", "StopBit", "1", filename)
lll = WritePrivateProfileString("Comm1", "DataBit", "8", filename)
lll = WritePrivateProfileString("Comm1", "Parity", "N", filename)
lll = WritePrivateProfileString("Comm2", "Port", "2", filename)
lll = WritePrivateProfileString("Comm2", "Baud", "19200", filename)
lll = WritePrivateProfileString("Comm2", "StopBit", "1", filename)
lll = WritePrivateProfileString("Comm2", "DataBit", "8", filename)
lll = WritePrivateProfileString("Comm2", "Parity", "N", filename)
lll = WritePrivateProfileString("Comm3", "Port", "3", filename)
lll = WritePrivateProfileString("Comm3", "Baud", "19200", filename)
lll = WritePrivateProfileString("Comm3", "StopBit", "1", filename)
lll = WritePrivateProfileString("Comm3", "DataBit", "8", filename)
lll = WritePrivateProfileString("Comm3", "Parity", "N", filename)
lll = WritePrivateProfileString("Comm4", "Port", "4", filename)
lll = WritePrivateProfileString("Comm4", "Baud", "19200", filename)
lll = WritePrivateProfileString("Comm4", "StopBit", "1", filename)
lll = WritePrivateProfileString("Comm4", "DataBit", "8", filename)
lll = WritePrivateProfileString("Comm4", "Parity", "N", filename)
lll = WritePrivateProfileString("Lock", "Locklong", "150", filename)
lll = WritePrivateProfileString("Lock", "LockRoad", "13", filename)
lll = WritePrivateProfileString("Lock", "LockFlag", "1", filename)
lll = WritePrivateProfileString("NetWork", "IP_Addr", "168.8.8.11", filename)
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -