![]() |
![]() ![]() ![]() ![]()
|
| Tutorial Section I |
|
The following simple program calling two sets of API functions that will allow a user to shut down a computer at a specific time set by the user. ExitWindowsEx will be used to shut down the PC and GetSystemTime will be used to get the actual system time in GMT. This program is similar to the sleep setting on your TV. So after your through with this simple tutorial you'll never have to worry about whether or not you turned of the computer or not. In this tutorial I'll also introduce you to Visual Basic's API viewer. Which helps you implement the right API syntax statements into you Code. OK go ahead and fire up Visual Basic and select a new Project. Once this is done your screen should displays the new project with one form. Go ahead and name the form frmShutDown. Next we are going to need a Module so go ahead and add one and name it basShutDown. Next select the form and design the Object to look similar like fig.1, the following is a list of controls that are necessary for the project to run. |
|
|
Fig.1
|
|
Now that you have the Object all straightened out, next is the code. Like previously discussed in the introduction to API we don't really need a module for the following step. In our case to simplify things visually speaking that is, I'm going to use one. This will make the distinction between declaring an API function and Calling it a bit clearer. Let's first take a look at Visual Basic's API Viewer. |
| Well what are you waiting for lets go on . . . |
|