Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to change display settings: screen resolution, screen refresh rate
Enumerating data formats currently available on the clipboard
Custom GDI+ class
Winsock: sending email messages (SMTP, port 25)
Mapping and disconnecting network drives
Capturing keyboard activity of another application with the Raw Input API (VFP9)
Winsock: retrieving directory listing from an FTP server using passive data connection (FTP, port 21)
Converting Unicode data from the Clipboard to a character string using a given code page
Enumerating raw input devices attached to the system (keyboard, mouse, human interface device)
How to display the Properties dialog box for a file (ShellExecuteEx)
Disk in drive A:
Enumerating network resources
Detecting changes in connections to removable drives (VFP9)
Using Font and Text functions
How to download a file from the FTP server using FtpGetFile
Splash Screen for the VFP application
How to play AVI file on the _screen
Using EnumPrinters function to enumerate locally installed printers
Retrieving the name of the network resource associated with a local device
Using Video Capture: displaying on FoxPro form frames and previewing video obtained from a digital camera
Running MSDOS Shell as a child process with redirected input and output (smarter RUN command)
Creating a console window for Visual FoxPro application
Creating irregularly shaped FoxPro form using transparency color key
How to put a horizontal text scrolling on the form (a news line)
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: 77  
    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 (107.21.186.38)
    4 sec.Example: 'Saying "Hello World!" with VFP and WinAPI'
    20.5 min.Example: 'Accessing examples contained in this reference from a VFP application'
    20.57 min.Example: 'Confining Windows calculator inside the VFP main window'
    33.8 min.Function: 'CeRegDeleteValue'
    33.83 min.Example: 'Printing Image File, programmatically set print page orientation to landscape'
    3.59 hrs.Example: 'How to print a bitmap file'
     Function: 'JetRollback'
    Function group: 'Extensible Storage Engine (ESE, Jet Blue)'
    9.77 hrs.Example: 'Retrieving window and menu help context identifiers'
     Example: 'Using File Mapping for enumerating files opened by Visual FoxPro'
    13.05 hrs.Example: 'Writing to INI file'
    Google
    Advertise here!