System Information
Page 1 of 1
System Information
- Code:
Imports System.Management
Imports System
Public Class Form1
Dim X, Y As Integer
Dim newpoint As System.Drawing.Point
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer3.Interval = 10
Timer3.Enabled = True
Timer1.Enabled = True
'Dim query As New SelectQuery("SELECT LastBootUpTime FROM Win32_OperatingSystem WHERE Primary='true'")
'Dim searcher As New ManagementObjectSearcher(query)
'' get the datetime value and set the local boot
'' time variable to contain that value
'Dim mo As ManagementObject
'For Each mo In searcher.Get()
' dtBootTime = _
' ManagementDateTimeConverter.ToDateTime(mo.Properties("LastBootUpTime").Value.ToString())
' ' display the start time and date
' txtDate.Text = dtBootTime.ToLongDateString()
' txtTime.Text = dtBootTime.ToLongTimeString()
'Next
'searcher = Nothing
'mo = Nothing
GetIPv4Address()
Label17.Text = My.Computer.Info.OSFullName
Label43.Text = My.User.Name
Label23.Text = My.Computer.Info.AvailablePhysicalMemory & " Bytes"
Label30.Text = My.Computer.Info.AvailableVirtualMemory & " Bytes"
Label31.Text = My.Computer.Info.OSPlatform
Label39.Text = My.Computer.Info.OSVersion
End Sub
Private Function GetIPv4Address() As String
GetIPv4Address = String.Empty
Dim strHostName As String = System.Net.Dns.GetHostName()
Dim iphe As System.Net.IPHostEntry = System.Net.Dns.GetHostEntry(strHostName)
For Each ipheal As System.Net.IPAddress In iphe.AddressList
If ipheal.AddressFamily = System.Net.Sockets.AddressFamily.InterNetwork Then
GetIPv4Address = ipheal.ToString()
Label33.Text = GetIPv4Address
Label34.Text = strHostName
End If
Next
End Function
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
Dim ts As TimeSpan = DateTime.Now - dtBootTime
txtLapsedHours.Text = (ts.Hours).ToString()
txtLapsedMinutes.Text = (ts.Minutes).ToString()
txtLapsedSeconds.Text = (ts.Seconds).ToString()
End Sub
Private dtBootTime As New DateTime()
Declare Function GetKeyState Lib "user32" Alias "GetKeyState" (ByVal ByValnVirtKey As Int32) As Int16
Private Const VK_CAPSLOCK = &H14
Private Const VK_NUMLOCK = &H90
Public Sub New()
InitializeComponent()
Timer2.Enabled = True
End Sub
Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick
Timer3.Interval = 10
If GetKeyState(VK_CAPSLOCK) = 1 And GetKeyState(VK_NUMLOCK) = 1 Then
Label55.Text = "CAPS & NUM ON"
ElseIf GetKeyState(VK_CAPSLOCK) = 1 And GetKeyState(VK_NUMLOCK) <> 1 Then
Label55.Text = "CAPS ON"
ElseIf GetKeyState(VK_CAPSLOCK) <> 1 And GetKeyState(VK_NUMLOCK) = 1 Then
Label55.Text = "NUM ON"
Else
Label55.Text = ""
End If
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim psBattery As PowerStatus = SystemInformation.PowerStatus
Dim perFull As Single = psBattery.BatteryLifePercent
If perFull * 100 > 100 Then
ProgressBar1.Value = 100
ElseIf perFull * 100 < 100 Then
ProgressBar1.Value = perFull * 100
End If
If psBattery.PowerLineStatus = PowerLineStatus.Online Then
Label54.Text = "Battinfo - " & perFull * 100 & "%" & " charging!"
ElseIf psBattery.PowerLineStatus = PowerLineStatus.Offline Then
If (perFull * 100) < 50 Then
Label54.Text = "Battinfo - " & perFull * 100 & "%" & " Connect Charger!"
Else
Label54.Text = "Battinfo - " & perFull * 100 & "%" & "Disconnect charger!"
End If
End If
Timer1.Interval = 1000
End Sub
Private Sub SI_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
X = Control.MousePosition.X - Me.Location.X
Y = Control.MousePosition.Y - Me.Location.Y
End Sub
Private Sub SI_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
If e.Button = Windows.Forms.MouseButtons.Left Then
newpoint = Control.MousePosition
newpoint.X -= (X)
newpoint.Y -= (Y)
Me.Location = newpoint
End If
End Sub
Private Sub Label6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label6.Click
Me.Close()
End Sub
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
Me.Hide()
About.Show()
End Sub
End Class
giovhz- Newbie
- Posts : 41
Join date : 2013-03-09
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|