Better process name extraction

Added better support for extracting the process name from the window
handle.