Skip to content

Latest commit

 

History

History
106 lines (91 loc) · 4.98 KB

CloseHandle.md

File metadata and controls

106 lines (91 loc) · 4.98 KB

Home

Function name : CloseHandle

Group: Handle and Object - Library: kernel32


The CloseHandle function closes an open object handle.

The CloseHandle function closes handles to the following objects: - Access token - Communications device - Console input - Console screen buffer - Event - File - File mapping - Job - Mailslot - Mutex (MutuallyExclusive) - Named pipe - Process - Semaphore - Socket


Code examples:

Using the Semaphore object
Using the CreateFile
Using the DeleteFile
Creating a file, then moving it to another destination
Setting the date and time that a file was created
Obtaining physical parameters for a drive: sectors, clusters, cylinders...
Using GetFileSize
Using the Semaphore object to allow only one instance of VFP application running
Locking and unlocking file of a VFP table
Enumerating Processes -- WinNT
Enumerating Processes -- Win9*
Comparing file times
HOWTO: Use the Win32 API to Access File Dates and Times
Storing screen shot of a form to bitmap file
Storing content of the Clipboard to a bitmap file
Using InternetSetFilePointer when resuming interrupted download from the Internet
Reading and setting the priority class values for the current process and thread
Retrieving file information for the VFP executable running
Terminating all running applications from a VFP program
Creating a mailslot
Using mailslots to send messages on the network
Testing serial ports
Passing data records between VFP applications via the Clipboard
Starting external program from VFP and waiting for its termination
Subclassing CommandButton control to create BackColor property
How to suspend or hibernate your system
Vertical Label control
How to set Creation Date/Time for a folder (WinNT)
Monitoring changes occurring within a directory
Peer-to-peer LAN messenger built with Mailslot API functions
How to Start a Process as Another User (NT/XP/2K)
How to run FoxPro application under different user name (impersonating user)
Using File Mapping for enumerating files opened by Visual FoxPro
Creating a console window for Visual FoxPro application
Running MSDOS Shell as a child process with redirected input and output (smarter RUN command)
How to make application automatically close all documents it opened
How to prevent users from accessing the Windows Desktop and from switching to other applications
How to convert a bitmap file to monochrome format (1 bpp)
Using shared memory to exchange data between applications (processes)
Using named pipes for interprocess communication
How to find when the application started
Obtaining I/O counts for the current process
Copying files as a transacted operation (Vista)
How to enable the SE_SHUTDOWN_NAME privilege for the application
Reading and setting system access privileges for the current process
Obtaining names and positions for shortcuts located on the Windows Desktop
How to check whether the system is 32-bit or 64-bit
Moving shortcut to a specified position on the Windows Desktop
How to load a user profile

Declaration:

BOOL CloseHandle(
  HANDLE hObject   // handle to object
);  

FoxPro declaration:

DECLARE INTEGER CloseHandle IN kernel32;
	INTEGER hObject  

Parameters:

hObject [in/out] Handle to an open object


Return value:

If the function succeeds, the return value is nonzero