Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 730
Bogdan Gavril MSFT Avatar asked Nov 18 '08 09:11

Bogdan Gavril MSFT


People also ask

How do you find the PID of a process?

Task Manager can be opened in a number of ways, but the simplest is to select Ctrl+Alt+Delete, and then select Task Manager. In Windows, first click More details to expand the information displayed. From the Processes tab, select Details to see the process ID listed in the PID column. Click on any column name to sort.

How do you find the PID of a service?

How to get PID using Task Manager. Press Ctrl+Shift+Esc on the keyboard. Go to the Processes tab. Right-click the header of the table and select PID in the context menu.

How do I find the process ID in Windows CMD?

Use the Command PromptIn the Start menu search bar, search for command prompt and select Run as administrator. Type tasklist. Press Enter. Command Prompt will now display the PID for the running processes.

What is Pid_t PID?

Data Type: pid_t. The pid_t data type is a signed integer type which is capable of representing a process ID. In the GNU library, this is an int . Function: pid_t getpid (void) The getpid function returns the process ID of the current process.


1 Answers

The GetCurrentProcessId function will do this.

like image 152
Greg Hewgill Avatar answered Oct 04 '22 07:10

Greg Hewgill