ServerAgent.CloseHandle
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
ServerAgent.CloseHandle
The CloseHandle method closes an open Windows object handle.
Syntax
public static int CloseHandle(
System.IntPtr hObject
);
Syntax
Public Shared Function CloseHandle( _
ByVal hObject As System.IntPtr _
)
As int
Parameters
- hObject
Specifies the object handle to close, such as the handle to a security token.
Return Values
If the function succeeds, the return value is nonzero. Otherwise, it returns zero (0). To get the specific Windows error code, create a new instance of Win32Exception, which will obtain the corresponding Windows error code, as demonstrated in the following code example.
if (ServerAgent.CloseHandle(mySecurityToken) == 0) {
Win32Exception e = new Win32Exception();
Console.WriteLine("Windows Error {0}: {1}", e.ErrorCode, e.Message);
}
A list of Windows error codes can be found in Winerror.h, which ships with the Microsoft Windows Platform SDK.
Remarks
Calling this method is identical to calling the Windows CloseHandle function in kernel32.lib (defined in Windows.h).
Requirements
Redistributable: Requires Microsoft Office Communications Server 2007 R2.
Namespace:Microsoft.Rtc.Sip
Assembly: ServerAgent (in ServerAgent.dll)