Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to initiate System shutdown
Retrieving the name of the network resource associated with a local device
Creating irregularly shaped FoxPro form using transparency color key
Drawing a rectangle using Windows regular edges and borders
Drawing standard Windows icons
Enumerating ODBC Data Sources available on the local computer
How to detect if additional monitor is connected and active
How to retrieve adapter information for the local computer (including MAC address)
Switching between keyboard layouts
Adding user-defined items to the Control Menu of VFP form (requires VFP9)
Semi-transparent Form
Storing content of the Clipboard to a bitmap file
System and Local Time values
Using Font and Text functions
How to enumerate sessions and processes on a specified terminal server
Converting command-line string to a set of Unicode argument strings (WinNT only)
Creating the Save dialog box to specify the drive, directory, and name of a file to save
Enumerating devices installed on the local machine
Initiating Inet connection using a modem
Moving shortcut to a specified position on the Windows Desktop
Reading metrics for the currently selected font
Subclassing CommandButton control to create BackColor property
Testing if a connection to an Url can be established
How to play AVI file on the _screen
How to initiate System shutdown

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
More code examples    Listed functions    Add comment     W32 Constants      Translate this page Printer friendly version of this code sample
Before you begin:
See also:
  • Closing Windows
  • Restarting Windows
  • How to suspend or hibernate your system
  • Enabling the SE_SHUTDOWN_NAME privilege for the application

  •  
    DO declare
     
    LOCAL cMachineName, nResult
    cMachineName=""
     
    nResult=InitiateSystemShutdown(cMachineName,;
        "System Shutdown initiated...", 10, 0, 1)
     
    IF nResult = 0
    * Common reasons for failure include an invalid 
    * or inaccessible computer name or insufficient privilege. 
        *   5 = ERROR_ACCESS_DENIED
        *  53 = ERROR_BAD_NETPATH
        * 120 = ERROR_CALL_NOT_IMPLEMENTED -- not supported in Win9*
        ? "Error code:", GetLastError()
    ENDIF
     
    PROCEDURE declare
        DECLARE INTEGER GetLastError IN kernel32
     
        DECLARE INTEGER InitiateSystemShutdownA IN advapi32;
        AS InitiateSystemShutdown ;
            STRING lpMachineName, STRING lpMessage,;
            INTEGER dwTimeout, SHORT bForceAppsClosed,;
            SHORT bRebootAfterShutdown
     

    User rating: 0/10 (0 votes)
    Rate this code sample:
    • ~
    714 bytes  
    Created: 2001-08-27 12:00:00  
    Modified: 2009-02-02 15:55:51  
    Visits in 7 days: 135  
    Listed functions:
    GetLastError
    InitiateSystemShutdown
    Printer friendly API declarations
    My comment:
    To shut down the local computer, the calling thread must have the SE_SHUTDOWN_NAME privilege.

    The InitiateSystemShutdownEx initiates a shutdown and optional restart of the specified computer, and optionally records the reason for the shutdown.
    Word Index links for this example:
    Translate this page:
      Spanish    Portuguese    German    French    Italian  
    FreeTranslation.com offers instant, free translations of text or web pages.
    User Contributed Notes:
    There are no notes on this subject.


    Copyright © 2001-2013 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.1.55-log), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
    Last Topics Visited (23.20.196.179)
    4 sec.Function: 'GetVersionEx'
    4.12 hrs.Function: 'GetDlgItem'
     Function: 'LocalSize'
    7.6 hrs.Example: 'GDI+: copying to the Clipboard (a) image of active FoxPro window/form, (b) image file'
    11.32 hrs.Function: 'DeleteObject'
    Google
    Advertise here!