Home  |   French  |   About  |   Search  | mvps.org  

What's New
Table Of Contents
Credits
Netiquette
10 Commandments 
Bugs
Tables
Queries
Forms
Reports
Modules
APIs
Strings
Date/Time
General
Downloads
Resources
Search
Feedback
mvps.org

In Memoriam

Terms of Use


VB Petition

API: Exit Windows

Author(s)
Dev Ashish

(Q)    How do I quit Windows from Access?

(A)    Pass the function fTerminateWin one of the declared constants.

CAUTION: This function returns immediately and the shutdown proceeds in the background. Be sure to terminate your own application to help the shutdown proceed smoothly.

'**************** Code Begin *******************
' This code was originally written by Dev Ashish.
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.
'
' Code Courtesy of
' Dev Ashish
'
Private Declare Function apiExitWindowsEx Lib "user32" _
        Alias "ExitWindowsEx" _
        (ByVal uFlags As Long, ByVal dwReserved As Long) _
        As Long

Public Const EWX_FORCE = 4      'Forcibly terminates processes
                                'that do not respond.
Public Const EWX_LOGOFF = 0     'Terminates processes, then logs off.
Public Const EWX_SHUTDOWN = 1   'Powers the system off, if possible.
Public Const EWX_REBOOT = 2     'Reboots the system.

Function fTerminateWin(lngExitVal As Long)
    fTerminateWin = apiExitWindowsEx(lngExitVal, 0)
End Function
'***************** Code End  *******************

© 1998-2010, Dev Ashish & Arvin Meyer, All rights reserved. Optimized for Microsoft Internet Explorer