| Viewing Single Post From: System information | |
|---|---|
| Hacker-X | Jul 9 2006, 08:11 PM |
|
Dedicated Member
![]() ![]() ![]() ![]() ![]() ![]()
|
Some aspects of this tutorial require a laptop computer! Today you'll learn how to find out whenther your computer is or isn't plugged into AC power using the If and Then statement. You'll also learn how to get current percentage of your battery remaining, you'll use the shell command to open a wireless network utility, find your local IP address. Timers play a big part in this tutorial so hopefully understand the basics of timers. What you'll need are 3 timers, default names set the interval to 10. You must also have 4 labels and 4 frames, default names of each will do. You'll need to add 2 components: Microsoft SysInfo Control 6.0 and Microsoft Winsock Control 6.0 (SP5). Now that we've got that out of the way rename the winsock control to "sock" (without the quotes) and don't rename SysInfo1. Right now would be a good time to find you wireless network utility, just right click the shortcut and click properties and copy the target. Now that you've found your wireless utility and copied the target just make a command button with the caption "View wireless networks." Switch to code view and add this code:
On to battery life percentage, we want live information, also known as dynamic text and in order to do that we need to make use of one of the timers. Make a label keep the default name. Switch to code view and add this:
Here comes the fun part, the part when you get to use the if and then statements but in order to understand this you must first understand binary, binary is what your computer parses everyday, sets of ones and zeros, this is how data is set on the internet or to any computer. Ones mean "on" and zeros mean "off" you can apply this concept to the SysInfo and figure out whether or not the computer is or isn't plugged into AC (alternating current), as oppsed to DC (direct current) a battery is direct current. The code:
To get your local IP address just add this code:
You must now enable all of these timers, so the labels captions can update, when the form loads, VB 6 makes it too easy. The code:
Full code:
Here is a screenshot of what I came up with:
|
![]() |
|
| System information · Visual Basic | |




![]](http://209.85.12.237/static/1/pip_r.png)


9:33 PM Nov 26