Hooked Procedure Early Return In/External Trigger
I've hooked into an application succesfully using WH_CALLWNDPROCRET or WH_CALLWNDPROC both give the same issue detailed below.
In the hooked callback function I trigger my code by waiting for a spceific window message.
Once the hooked callback function receives this message, my code is triggered and executes a right click on an "Edit" window where normally a menu (which is a new handle) is created.
Here is the rub, the menu window is not created until my call back function returns its value.
So my code, though it sends the proper right click message, cannot find the menu, because the menu hasn't been created yet, because the hooked callback function has not returned its value (because my code is still executing).
However, if i execute the code from outside of a hook (say i trigger it myself from a command line), the menu appears and my code can find the menu and everything works as I expect.
What would be a work around for this.
For instance could I use the hook function to post a message to a program i create designed to handle messages from this hooked procedure.
I really don't want to do that, as that would mean changing from a command line to a gui event based program.
Or can I make a command line program event based?
My first question is, however, dealing with the 'delayed' menu window creation.
For instance, is there a way to instantly return my hooked call back procedure and then proceed with my code?