| | |
Hooked Procedure Early Return In/External Trigger
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Apr 2008
Posts: 15
Reputation:
Solved Threads: 1
Hooked Procedure Early Return In/External Trigger
Hello,
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?
Thanks,
Hello,
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?
Thanks,
![]() |
Other Threads in the C++ Forum
- Previous Thread: New to C++ and need a bit of help
- Next Thread: Find then Show window.
Views: 487 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for C++
6 api application array arrays assignment beginner binary bitmap c++ c/c++ calculator char class classes code coding compile compiler console conversion convert count data database delete developer display dll email encryption error file forms fstream function functions game generator getline givemetehcodez graph homeworkhelper iamthwee ifstream image input int java lazy lib loop looping loops map math matrix memory multidimensional multiple newbie news node number output parameter pointer problem program programming project proxy python random read recursion recursive reference return sort sorting string strings struct template templates text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets





