Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This function closes an open object handle that was created using RAPI or RAPI2 methods.

Syntax

BOOL CeCloseHandle( 
  HANDLE 
hObject 
);

Parameters

hObject

Handle to an open object.

Return Value

Nonzero indicates success. Zero indicates failure. To get extended error information, call IRAPISession::CeGetLastError. Call GetLastErrorto get information about errors that are not related to RAPI2.

Remarks

The IRAPISession::CeCloseHandlefunction closes handles to the following objects.

  • Communications device

  • Database

  • Event

  • File

  • Mutex

  • Process

  • Socket

  • Thread

IRAPISession::CeCloseHandleinvalidates the specified object handle, decrements the object's handle count, and performs object retention checks. After the last handle to an object is closed, the object is removed from the system.

Closing a thread handle does not terminate the associated thread. To remove a thread object, you must terminate the thread, and then close all handles to the thread.

Use IRAPISession::CeCloseHandleto close handles returned by calls to the IRAPISession::CeCreateFilemethod. Use IRAPISession::CeFindCloseto close handles returned by calls to the IRAPISession::CeFindFirstFilemethod.

To get extended error information, call IRAPISession::CeGetLastErrorand IRAPISession::CeRapiGetError.

Requirements

Header rapi2.h
Library ole32.lib, rapiuuid.lib
Windows Embedded CE Windows Embedded CE 6.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also