win32api.GetCurrentProcessId

int = GetCurrentProcessId()

Returns the thread ID for the current process.

Win32 API References

Search for GetCurrentProcessId at msdn, google or google groups.