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

📄 gpsdevicestate.vb

📁 清华大学出版社出版的 移动应用开发宝典 张大威(2008)的附书源代码
💻 VB
字号:
Imports System.Runtime.InteropServices

Namespace Microsoft.WindowsMobile.Samples.Location

    Public Enum GpsServiceState
        Unknown = -1
        [Off] = 0
        [On] = 1
        StartingUp = 2
        ShuttingDown = 3
        Unloading = 4
        Uninitialized = 5
    End Enum



    Public Class GpsDeviceState

        Private m_device As GPS_DEVICE
        Public Const GpsDeviceStructureSize As Integer = &HD8

        Friend Sub New(ByVal device As GPS_DEVICE)
            m_device = device
        End Sub

        Public ReadOnly Property DeviceState() As GpsServiceState
            Get
                Return DirectCast(m_device.dwDeviceState, GpsServiceState)
            End Get
        End Property

        Public ReadOnly Property DriverPrefix() As String
            Get
                Return m_device.szGPSDriverPrefix
            End Get
        End Property

        Public ReadOnly Property FriendlyName() As String
            Get
                Return m_device.szGPSFriendlyName
            End Get
        End Property

        Public ReadOnly Property MultiplexPrefix() As String
            Get
                Return m_device.szGPSMultiplexPrefix
            End Get
        End Property

        Public ReadOnly Property ServiceState() As GpsServiceState
            Get
                Return DirectCast(m_device.dwServiceState, GpsServiceState)
            End Get
        End Property

    End Class

    <StructLayout(LayoutKind.Sequential)> _
    Friend Structure GPS_DEVICE

        Friend Const GPS_MAX_FRIENDLY_NAME As Integer = &H40
        Friend Const GPS_MAX_PREFIX_NAME As Integer = &H10

        Public dwVersion As Integer
        Public dwSize As Integer
        Public dwServiceState As Integer
        Public dwDeviceState As Integer
        Public ftLastDataReceived As Long
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=&H10)> _
        Public szGPSDriverPrefix As String
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=&H10)> _
        Public szGPSMultiplexPrefix As String
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=&H40)> _
        Public szGPSFriendlyName As String

    End Structure




End Namespace

⌨️ 快捷键说明

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