Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

My.Power Extension (VSX)

0.00/5 (No votes)
31 Mar 2010 1  
A My Namespace extension that makes things such as shutting down your computer easier.

Introduction

I got the idea for this extension while reading an article a while back about extending the My Namespace, and one of the sample ideas suggested in the article was "My.Computer.Shutdown". I did not copy that, but I used it as a base for this extension, making things like turning off a computer, getting laptop battery power, and putting the computer into hibernation. Simple stuff, but done quicker.

Using the Code

To install the extension, download the zip file at the top of this page, extract it, and install the .vsix file into Visual Studio 2010. After that, you can load a Visual Basic project and add My.Power to the project using the Add -> New Item menu button.

Now, you can do things like shut down a user's computer:

My.Computer.ShutOff		

If you want to get a battery's charge percent, you can type something like this:

Label1.Text = My.Computer.BatteryPercent		

It's just that easy!

This item template can be installed into Visual Basic 2010 Express Edition, as well as all of the higher-end versions of Visual Studio 2010.

I hope that you find this useful!

History

  • 31st March, 2010: Initial post

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here