Some system things

Use this board to post your code snippets - tips and tricks
5 posts Page 1 of 1
Contributors
User avatar
RunarM
Hardcore Programmer
Hardcore Programmer
Posts: 508
Joined: Wed Nov 18, 2009 11:33 pm

Some system things
RunarM
Here are some system things ;P

Battery:
This will show you how many % power you have and if its charging or not:

What you need:
*2 Textboxes
*1 Timer

-Textbox1 is the Power %
-Textbox2 will show if its charging or not

-Double click on the timer and enter this code:
Code: Select all
TextBox1.Text = ("" & perFull * 100 & "%")
If psBattery.PowerLineStatus = PowerLineStatus.Online Then
            TextBox2.Text = ("Charging")
        ElseIf psBattery.PowerLineStatus = PowerLineStatus.Offline Then
            TextBox2.Text = ("Not charging")
        End If
and now it should show you how much power and if its charging..

<-------------------->

How to see how much space you got left in your :C : D :E :F
//Show How many Gb and how many mbs

You need 16 Labels.. [or 8 if you only want to know one of mb or gb]

For the C:
Just double click on the form and enter this:
Code: Select all
Dim freeSpaceC As Long
        freeSpaceC = My.Computer.FileSystem.GetDriveInfo("C:\").AvailableFreeSpace / 1000000000
        Label3.Text = freeSpaceC & ".0 GB Left"

        freeSpaceC = My.Computer.FileSystem.GetDriveInfo("C:\").TotalSize / 1000000000
        Label6.Text = freeSpaceC & ".0 GB Total"
Thats for Gbs and this is for Mbs:
Code: Select all
        freeSpaceC = My.Computer.FileSystem.GetDriveInfo("C:\").AvailableFreeSpace / 1000000
        Label11.Text = freeSpaceC & ".0 MB Left"

        freeSpaceC = My.Computer.FileSystem.GetDriveInfo("C:\").TotalSize / 1000000
        Label12.Text = freeSpaceC & ".0 MB Total"
Now i have already added all 16 labels and it looks like this:
Image

Here is the full code:
Code: Select all
        Dim freeSpaceC As Long
        freeSpaceC = My.Computer.FileSystem.GetDriveInfo("C:\").AvailableFreeSpace / 1000000000
        Label3.Text = freeSpaceC & ".0 GB Left"

        freeSpaceC = My.Computer.FileSystem.GetDriveInfo("C:\").TotalSize / 1000000000
        Label6.Text = freeSpaceC & ".0 GB Total"

        freeSpaceC = My.Computer.FileSystem.GetDriveInfo("C:\").AvailableFreeSpace / 1000000
        Label11.Text = freeSpaceC & ".0 MB Left"

        freeSpaceC = My.Computer.FileSystem.GetDriveInfo("C:\").TotalSize / 1000000
        Label12.Text = freeSpaceC & ".0 MB Total"

        Dim FreeSpaceD As Long
        FreeSpaceD = My.Computer.FileSystem.GetDriveInfo("D:\").AvailableFreeSpace / 1000000000
        Label4.Text = FreeSpaceD & ".0 GB left"

        FreeSpaceD = My.Computer.FileSystem.GetDriveInfo("D:\").TotalSize / 1000000000
        Label7.Text = FreeSpaceD & ".0 GB Total"

        FreeSpaceD = My.Computer.FileSystem.GetDriveInfo("D:\").AvailableFreeSpace / 1000000000
        Label13.Text = FreeSpaceD & ".0 MB left"

        FreeSpaceD = My.Computer.FileSystem.GetDriveInfo("D:\").TotalSize / 1000000000
        Label14.Text = FreeSpaceD & ".0 MB Total"

        Dim FreeSpaceF As Long
        FreeSpaceF = My.Computer.FileSystem.GetDriveInfo("F:\").AvailableFreeSpace / 1000000000
        Label5.Text = FreeSpaceF & ".0 GB left"

        FreeSpaceF = My.Computer.FileSystem.GetDriveInfo("F:\").TotalSize / 1000000000
        Label8.Text = FreeSpaceF & ".0 GB Total"

        FreeSpaceF = My.Computer.FileSystem.GetDriveInfo("F:\").AvailableFreeSpace / 1000000
        Label9.Text = FreeSpaceF & ".0 MB left"

        FreeSpaceF = My.Computer.FileSystem.GetDriveInfo("F:\").TotalSize / 1000000
        Label10.Text = FreeSpaceF & ".0 MB Total"

        Dim FreeSpaceE As Long
        FreeSpaceE = My.Computer.FileSystem.GetDriveInfo("E:\").AvailableFreeSpace / 1000000000
        Label13.Text = FreeSpaceE & ".0 GB left"

        FreeSpaceE = My.Computer.FileSystem.GetDriveInfo("E:\").TotalSize / 1000000000
        Label14.Text = FreeSpaceE & ".0 GB Total"

        FreeSpaceE = My.Computer.FileSystem.GetDriveInfo("E:\").AvailableFreeSpace / 1000000
        Label15.Text = FreeSpaceE & ".0 MB left"

        FreeSpaceE = My.Computer.FileSystem.GetDriveInfo("E:\").TotalSize / 1000000
        Label16.Text = FreeSpaceE & ".0 MB Total"
You see the E: Isnt available [spelled it wrong] thats cause i don't have any CD or Dvd, the F: is my free usb ;)

GB = 1000000000
MB = 1000000
KB: 1000

<-------------------->


Download the Source:
*It comes with system info + Screen show taker on x interval


Image

-RunarM
You do not have the required permissions to view the files attached to this post.
Just another day in my life.
http://www.codexvideos.com
GoodGuy17
Coding God
Coding God
Posts: 1610
Joined: Mon Sep 07, 2009 12:25 am

Re: Some system things
GoodGuy17
Thanks when CodenStuff told me that code for memory getter, and it showed like 12 digits I needed this too!
User avatar
AleRi8
Top Poster
Top Poster
Posts: 153
Joined: Sun Sep 20, 2009 2:30 pm

Re: Some system things
AleRi8
wow thanks for sharing this.
check out my software
win7 itweaker basic £4.50
viewtopic.php?f=70&t=793
User avatar
un kn0 wn
VIP - Donator
VIP - Donator
Posts: 269
Joined: Mon Mar 29, 2010 6:12 pm

Re: Some system things
un kn0 wn
thx for sharing this m8.
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: Some system things
mandai
Still nothing quite like that msinfo32 though
5 posts Page 1 of 1
Return to “Quick Snips”