Find the PID for my app.

Such a simple thing but I couldn’t seem to find the answer. I know I can look in the task manager to see the PID for my app, but how can I get the PID in the app itself?

I would have expected something like: app.PID

Have a look at the Windows Functionality Suite.
There you’ll find the following code (and much, much more):

[code]Protected Function GetCurrentProcessID() as Integer
#if TargetWin32
Declare Function MyGetCurrentProcessId Lib “Kernel32” Alias “GetCurrentProcessId” () as Integer

return MyGetCurrentProcessID

return 0
End Function[/code]

Sweet. I’m not sure how I could miss such a useful tool.