Windows Mobile 6.5
A version of this page is also available for

This function returns a value that is unique to the current thread. CoGetCurrentProcess can be used to avoid thread ID reuse problems.

DWORD CoGetCurrentProcess(void);


Unique DWORD value identifying the current thread.

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

The CoGetCurrentProcess function 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 CoGetCurrentProcess will 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 DWORD returned by the Win32 function GetCurrentThreadId.

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

Windows Embedded CEWindows CE 3.0 and later
Windows MobileWindows Mobile Version 5.0 and later

Community Additions