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

📄 frm_about.vb

📁 基于Windows Mobile平台的客户关系系统(CRM)
💻 VB
字号:
Public Class frm_about

    Public Class SYSTEM_POWER_STATUS_EX2
        Public ACLineStatus As Byte
        Public BatteryFlag As Byte
        Public BatteryLifePercent As Byte
        Public Reserved1 As Byte
        Public BatteryLifeTime As Int32
        Public BatteryFullLifeTime As Int32
        Public Reserved2 As Byte
        Public BackupBatteryFlag As Byte
        Public BackupBatteryLifePercent As Byte
        Public Reserved3 As Byte
        Public BackupBatteryLifeTime As Int32
        Public BackupBatteryFullLifeTime As Int32
        Public BatteryVoltage As Int32
        Public BatteryCurrent As Int32
        Public BatteryAverageCurrent As Int32
        Public BatteryAverageInterval As Int32
        Public BatterymAHourConsumed As Int32
        Public BatteryTemperature As Int32
        Public BackupBatteryVoltage As Int32
        Public BatteryChemistry As Byte
    End Class 'SYSTEM_POWER_STATUS_EX2

    Public Class SYSTEM_POWER_STATUS_EX
        Public ACLineStatus As Byte
        Public BatteryFlag As Byte
        Public BatteryLifePercent As Byte
        Public Reserved1 As Byte
        Public BatteryLifeTime As Int32
        Public BatteryFullLifeTime As Int32
        Public Reserved2 As Byte
        Public BackupBatteryFlag As Byte
        Public BackupBatteryLifePercent As Byte
        Public Reserved3 As Byte
        Public BackupBatteryLifeTime As Int32
        Public BackupBatteryFullLifeTime As Int32
    End Class 'SYSTEM_POWER_STATUS_EX

    <Runtime.InteropServices.DllImport("coredll")> _
        Private Shared Function GetSystemPowerStatusEx(ByVal lpSystemPowerStatus As SYSTEM_POWER_STATUS_EX, ByVal fUpdate As Boolean) As Int32
    End Function

    <Runtime.InteropServices.DllImport("coredll")> _
        Private Shared Function GetSystemPowerStatusEx2(ByVal lpSystemPowerStatus As SYSTEM_POWER_STATUS_EX2, ByVal dwLen As Int32, ByVal fUpdate As Boolean) As Int32
    End Function

    Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem1.Click
        Me.Close()
    End Sub

    Private Sub frm_about_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        '刷新PDA电池信息
        RefreshStatus()
        '获取PDA Owner信息
        GetPDAOwnerInfo()
    End Sub

    Private Sub RefreshStatus()
        Dim status As New SYSTEM_POWER_STATUS_EX
        Dim status2 As New SYSTEM_POWER_STATUS_EX2
 
        If Convert.ToInt32(GetSystemPowerStatusEx(status, False)) = 1 Then
            'Do some further work here 
        End If
        If Convert.ToInt32(GetSystemPowerStatusEx2(status2, Convert.ToUInt32(Runtime.InteropServices.Marshal.SizeOf(status2)), False)) = Runtime.InteropServices.Marshal.SizeOf(status2) Then
            pgb_battery_main.Value = CInt(status2.BatteryLifePercent.ToString)
            pgb_battery_backup.Value = CInt(status2.BackupBatteryLifePercent.ToString)
        End If
    End Sub

    Private Sub GetPDAOwnerInfo()
        Dim RegData() As Byte = Nothing
        Dim RegRead As Microsoft.Win32.RegistryKey


        Try
            RegRead = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("\ControlPanel\Owner", True)
            If Not (RegRead Is Nothing) Then
                RegData = RegRead.GetValue("Owner")
            End If
            RegRead.Close()
            lb_owner_info.Items.Clear()
            lb_owner_info.Items.Add("姓名:" + System.Text.Encoding.Unicode.GetString(RegData, 0, 72).TrimEnd + vbCrLf) '("\0")
            lb_owner_info.Items.Add("单位:" + System.Text.Encoding.Unicode.GetString(RegData, 72, 72).TrimEnd + vbCrLf)
            lb_owner_info.Items.Add("地址:" + System.Text.Encoding.Unicode.GetString(RegData, 144, 372).TrimEnd + vbCrLf)
            lb_owner_info.Items.Add("电话:" + System.Text.Encoding.Unicode.GetString(RegData, 516, 50).TrimEnd + vbCrLf)
            lb_owner_info.Items.Add("电子邮件:" + System.Text.Encoding.Unicode.GetString(RegData, 566, 74).TrimEnd + vbCrLf)
        Catch ex As System.Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical, "警告")
        End Try
    End Sub
End Class

⌨️ 快捷键说明

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