Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get process serial number of current running process

In OS X 10.9 and below, we can get the process serial number of the current running process with:

ProcessSerialNumber pen;
GetCurrentProcess( &psn );

However, GetCurrentProcess() is now deprecated and I'm unsure how to find a process' serial number with NSRunningApplication.

like image 395
Lenny Avatar asked Sep 20 '16 23:09

Lenny


1 Answers

to get ProcessSerialNumber you can use:

ProcessSerialNumber psn;
psn.highLongOfPSN = 0;
psn.lowLongOfPSN = kCurrentProcess;
like image 139
Diana Vallverdu Avatar answered Jan 02 '23 09:01

Diana Vallverdu