The problem is that the icon handle gets destroyed as soon as your application terminates. You need to inject some code into the target process and execute LoadImage in the context of the target process. This way the icon handle will be accounted for that process and will remain valid as long as the target process exists.