Skip to main content

Problem:

How to look up the Process ID from the current process?

Resolution:

The following will show the Process ID (PID) of the current process.

01 CurrentProcessId          DWORD.

01 pSessionId                   DWORD.

           call cc74   "GetCurrentProcessId" returning CurrentProcessId

Another way to do this is with the use of API:

There are different ways for APIs for Win9x Platforms and for NT/2000/XP/2003 Platforms.

For Windows 2000 etc... You need the Process Status Helper API http://msdn.microsoft.com/library/?url=/library/en-us/perfmon/base/process_status_helper.asp?frame=true

For Windows 9x you need the ToolHelp Library http://msdn.microsoft.com/library/?url=/library/en-us/perfmon/base/process_status_helper.asp?frame=true

A simpler way would be the use of Mutex. For an example of Mutex please contact MicroFocus supportline.

Old KB# 7049