Visual Basic gives us access to the Windows API which allows us to do virtually anything. In this source sample we will use the GetSystemMetrics API located in the user32 dll to find out how Windows was started. This is helpful if you want to do something different with your application based on if Windows started in Safe Mode, Safe Mode with Network Support, or Normal mode.
The easiest way to call Windows API's is to declared them in a module so to try this out create a new VB project. Then go to the Project Menu and click Add Module. Inside this module add the following code.
No go to your main form, add a command button, double click on the button to go to its click event handler, and add the following code.
Once you've added the source code run your application and click on the button. You should see a message box that corresponds to the way you started Windows.
Obviously this just barely scratches the surface on what you can do with the Windows API. Check out the links below to find out more.