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 returns a value that is unique to the current thread. CoGetCurrentProcesscan be used to avoid thread ID reuse problems.

Syntax

DWORD CoGetCurrentProcess(void);

Parameters

None.

Return Value

Unique DWORDvalue identifying the current thread.

Remarks

Using the value returned from a call to CoGetCurrentProcesscan help you in maintaining tables that are keyed by threads or in uniquely identifying a thread to other threads or processes.

The CoGetCurrentProcessfunction returns a value that is effectively unique, because it is not used again until 232 more threads have been created on the current workstation or until the workstation is restarted.

The value returned by CoGetCurrentProcesswill uniquely identify the same thread for the life of the caller. Because thread IDs can be reused without notice as threads are created and destroyed, this value is more reliable than the DWORDreturned by the Win32 function GetCurrentThreadId.

To determine whether the platform supports this function, see Determining Supported COM APIs.

Requirements

Header objbase.h
Library ole32.lib
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

COM Functions