Parsi Coders
سورس کد خاموش کردن سیستم - نسخه قابل چاپ

+- Parsi Coders (http://parsicoders.com)
+-- انجمن: Software Development Programming (http://parsicoders.com/forumdisplay.php?fid=37)
+--- انجمن: Visual Basic Programming (http://parsicoders.com/forumdisplay.php?fid=39)
+---- انجمن: Visual Basic 6 (http://parsicoders.com/forumdisplay.php?fid=44)
+---- موضوع: سورس کد خاموش کردن سیستم (/showthread.php?tid=1390)



سورس کد خاموش کردن سیستم - Amin_Mansouri - 12-30-2011

Shutdown Computer from VB
Shows how to Shutdown,LogOff and Force Shutdown using VB

کد:
' SHUT DOWN AND RESTART IN VB6
       Const EWX_LogOff As Long = 0
       Const EWX_SHUTDOWN As Long = 1
       Const EWX_REBOOT As Long = 2
       Const EWX_FORCE As Long = 4
       Private Declare Function ExitWindows _
               Lib "User32" Alias "ExitWindowsEx" _
               (ByVal dwOptions As Long, ByVal dwReserved As Long) As Long
      
     Private Sub Command1_Click()

          'Shut down windows
          ExitWindows EWX_SHUTDOWN, &HFFFFFFFF
      
      
     End Sub
      
     Private Sub Command2_Click()
    
          
          ExitWindows EWX_REBOOT, &HFFFFFFFF
      
      
     End Sub