Visual Basic Code Snippets #5
In this next update I'll re-post my Visual Basic code snippets (which are older than five years by the way) that pertain to System Functions.
Shutdown/Poweroff Windows
Compatibility: Win. 98-XP
Add the following code into a module within your project...
Public Declare Function ExitWindowsEx Lib "User32" Alias "ExitWindowsEx"(ByVal uFlags As Long, ByVal dwReserved As Long) As Long
Add the following code into a command button or wherever you want the code to execute...
Call ExitWindowsEx(EWX_POWEROFF,0)
Restart Windows
Compatibility: Win. 98-XP
Add the following code into a module within your project...
Public Declare Function ExitWindowsEx Lib "User32" Alias "ExitWindowsEx"(ByVal uFlags As Long, ByVal dwReserved As Long) As Long
Add the following code into a command button or wherever you want the code to execute...
Call ExitWindowsEx(EWX_REBOOT,0)
Shell Out to Default Web Browser
Compatibility: Win. 98-XP
Add the following code into a module within your project...
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Public Const conSwNormal = 1
Public Function shellSite(site As String)
ShellExecute hwnd, "open", site, vbNullString, vbNullString, conSwNormal
End Function
Add the following code wherever you want the code to execute...
Call shellSite("http://www.beneskew.com")
