ms c++ get pid of current process
Parts of my application are in C++ under windows. I need the process id for the current process. Any thoughts? The GetCurrentProcessId function will do this. Having grown accustomed to seeing yards and yards of code to accomplish seemingly straightforward tasks, I was pleasantly surprised at the directness of GetCurrentProcessId . Earlier today, I watched it run in a debugger, when I was following a new bit of code in a DllMain routine that combines the process ID with an embedded GUID to create a locally unique name for a mutex. Following is the entire routine, all three machine instructions.