Using Win32 functions in Visual FoxPro Image Gallery
System Shutdown
Code examples:
..msdn    Add comment     W32 Constants      Translate this page
Initiates a shutdown and restart of the specified computer, and restarts any applications that have been registered for restart.
Code examples:
DWORD WINAPI InitiateShutdown(
  __in_opt  LPTSTR lpMachineName,
  __in_opt  LPTSTR lpMessage,
  __in      DWORD dwGracePeriod,
  __in      DWORD dwShutdownFlags,
  __in      DWORD dwReason
FoxPro declaration:
DECLARE INTEGER InitiateShutdown IN Advapi32;
    STRING lpMachineName,;
    STRING lpMessage,;
    LONG dwGracePeriod,;
    LONG dwShutdownFlags,;
    LONG dwReason
lpMachineName [in, optional]
The name of the computer to be shut down. If the value of this parameter is NULL, the local computer is shut down.

lpMessage [in, optional]
The message to be displayed in the interactive shutdown dialog box.

dwGracePeriod [in]
The number of seconds to wait before shutting down the computer.

dwShutdownFlags [in]
One or more bit flags that specify options for the shutdown.

dwReason [in]
The reason for initiating the shutdown. This parameter must be one of the system shutdown reason codes.
Return value:
If the function succeeds, it returns ERROR_SUCCESS (0).

? InitiateShutdown("", "The system is shutting down...",;
My comment:
To shut down the local computer, the calling thread must have the SE_SHUTDOWN_NAME privilege.

To shut down a remote computer, the calling thread must have the SE_REMOTE_SHUTDOWN_NAME privilege on the remote computer.

Minimum supported client: Windows Vista

See also: InitiateSystemShutdown
Word Index links for the InitiateShutdown :
Translate this page:
  Spanish    Portuguese    German    French    Italian offers instant, free translations of text or web pages.
Created: 2009-02-02 10:49:49
Modified: 2009-02-02 10:53:43
Visited in last 7 days: 24
User Contributed Notes:
There are no notes on this subject.

Copyright 2001-2018 News2News, Inc. Before reproducing or distributing any data from this site please ask for an approval from its owner. Unless otherwise specified, this page is for your personal and non-commercial use. The information on this page is presented AS IS, meaning that you may use it at your own risk. Microsoft Visual FoxPro and Windows are trade marks of Microsoft Corp. All other trademarks are the property of their respective owners. 

Privacy policy
Credits: PHP (4.4.9), an HTML-embedded scripting language, MySQL (5.6.39), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (
3 sec.Function: 'WinHttpQueryDataAvailable'
6 sec.Function: 'WinHttpReadData'
9 sec.
Function group: 'GDI+ ImageAttributes'
11 sec.Function: 'CreateFile'
13 sec.Function: 'UnhookWindowsHookEx'
16 sec.
Function group: 'Desktop Window Manager (DWM)'
18 sec.Function: 'GetTempPath'
20 sec.
Function group: 'GDI+ Bitmap'
23 sec.Function: 'WinHttpConnect'
25 sec.Function: 'GetSecurityDescriptorDacl'
Advertise here!