共用方式為


GetHandle

 

Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista

Returns a handle that can be passed to transacted Windows APIs to represent the transaction.

Syntax

  
HRESULT GetHandle(   HANDLE *   
pHandle  
);  
  

Parameters

pHandle
[out] A handle that can be passed to transaction Windows APIs to represent the transaction.

Return Values

S_OK
Success.

E_INVALIDARG
The MSDTC transaction is invalid.

XACT_E_NOTRANSACTION
The MSDTC transaction has already committed or aborted.

Remarks

The returned handle is placed in the location pointed to by the pHandle parameter. The handle is owned by the caller, who is expected to close it. Use the CloseHandle function to close the handle. The system closes the handle automatically when the process terminates. The handle has TRANSACTION_RESOURCE_MANAGER_RIGHTS.

In addition to the return values listed previously, this function can also return an error of the form 0x8007nnnn, where nnnn is the Win32 error code.

Requirements

For an explanation of the requirement values, see Requirements (Component Services).

Platforms: Windows Server 2016, Windows 10, Windows Server 2012 R2, Windows 8.1, Windows Server 2012, Windows 8, Windows Server 2008 R2, Windows 7, Windows Server 2008, Windows Vista

Header: Declared in transact.h