Can you get a process id from a process handle? I know that you can create a handle given a process id (using OpenProcess()).

ShellExecuteEx() does not always create a new process and I want to be able to activate the existing process that ShellExecuteEx returns a handle to.

The only way I know how to do this is to have a process id then look for the windows associated with the process id. But ShellExecuteEx does not return a process id.