Code Snippets

  

Visual Basic Source Code


Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 117,542 VB Programmers for FREE! Ask your question and get quick answers from experts. There are 1,673 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!




Shutdown Computer from VB

Shows how to Shutdown,LogOff and Force Shutdown using VB

Submitted By: born2c0de
Actions:
Rating:
Views: 33,761

Language: Visual Basic

Last Modified: March 5, 2005

Snippet


  1. ' SHUT DOWN AND RESTART IN VB6
  2.        Const EWX_LogOff As Long = 0
  3.        Const EWX_SHUTDOWN = 1
  4.        Const EWX_REBOOT = 2
  5.        Const EWX_FORCE = 4
  6.        Private Declare Function ExitWindows _
  7.                Lib "User32" Alias "ExitWindowsEx" _
  8.                (ByVal dwOptions As Long, ByVal dwReserved As Long) As Long
  9.      
  10.      Private Sub Command1_Click()
  11.  
  12.           'Shut down windows
  13.           ExitWindows EWX_SHUTDOWN, &HFFFFFFFF
  14.      
  15.      
  16.      End Sub
  17.      
  18.      Private Sub Command2_Click()
  19.      
  20.          
  21.           ExitWindows EWX_REBOOT, &HFFFFFFFF
  22.      
  23.      
  24.      End Sub
  25.      
  26.      
  27.  
  28.  

Copy & Paste


Comments


shankarpatil 2008-08-19 04:34:31

hi sir, iam shankar patil from - kolhapur disctic please me option button socurce code vb 6.0 in a program. example : exam form & 4 option button, then click the one button msgbox("you are wrong answer?" & "You are carrect answer?")


Add comment


You must be registered and logged on to </dream.in.code> to leave comments.





Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month