Failed calling SetApplication, error = 0x80070005

Hi,
I am getting the following error while running the hookapp. It does not give any clue why it is throwing this error.
Does anyone know how to resolve this problem?
Thank you.

hookaap
Failed calling SetApplication, error = 0x80070005
