FREE tutorial,solution,RSS Feeds on Operating Systems, Programming, Web Development, Applications, Databases, Networking, Hardware, Security, SEO Free Expertsforge Membership
Join us as Moderator
Submit Article to Expertsforge.com Submit Article My Expertsforge
 
RSS Feeds, Help Help RSS Feeds
bannertop
 

VB Tutorial: How to Shutdown a Computer using Visual Basic

jawahar
3/26/2005 2:48:22 AM, Views: 2576
Shutting down a Computer using Visual Basic

Requirements:
A Form
A Module
3 Commandbuttons

Module Code:
Public Declare Function ExitWindowsEx Lib "user32" (ByVal uflags As Long,
ByVal dwReserved As Long) As Long Public Const EXIT_LOGOFF = 0 Public
Const EXIT_SHUTDOWN = 1 Public Const EXIT_REBOOT = 2 Public Sub ShutDown()
Call ExitWindowsEx(EXIT_SHUTDOWN, 0) End Sub
Public Sub Restart()
Call ExitWindowsEx(EXIT_REBOOT, 0) End Sub
Public Sub Logoff()
Call ExitWindowsEx(EXIT_LOGOFF, 0) End Sub

Form Code:
Private Sub Command1_Click()
restart End Sub
Private Sub Command2_Click()
shutdown end sub
Private Sub Command3_Click()
logoff end sub
Next Steps:
Add this Tutorial to:
Blink Blink del.icio.ous Del.icio.us Digg Digg
Fark Fark Furl Furl Google Google
Reddit Reddit Simpy Simpy Spurl Spurl
Technorati Technorati Windows Live Win Live Yahoo Yahoo
Rate Me!
Avg Visitor Rating: Average Visitor Rating is 3.5 out of 5
Number of Ratings : 2 Votes
Rate:
Send Private MessageSend Message
Signup / Login To View the Solution or Provide Comments
Post Comment/Solution
Comment:*
        (Link Rules) 
  Use : [bold] for <b>; [/bold] for </b>; [italic] for <i>; [/italic] for </i>; [code] & [/code] for code
 
Categories
Options
VB RSS Feed
Most Popular Tutorial
Most Popular Solution
No Records!
Top Rated
Top Rankers
Overall
1. jawahar (50)
Yearly -2008
No Rankings!
Expertsforge Sponsors
bnrtop