Re: Need guidance on hooks
you can find it on http://www.pinvoke.net, there much samples about native windows api.
Re: Need guidance on hooks
Thanks rizkyaqew, pinvoke seems like something that will be useful to me in the future. However right now it just seems like a catalog of code unless I overlooked the website. I am looking for a further explanation of how a hook is structured even a brief description to get me started. I also a push towards which hook to use.
Re: Need guidance on hooks
Quote:
On this computer I need to monitor a specific setting in a program that is set by the user if it is running and check to see how long it is running.
This is so broad and vague that it simply isn't possible to guide you in any direction at all. If this is a third party program then your chances of identifying anything that could reliably be hooked to monitor this setting are not great. In terms of messages, these will only occur in changing the setting anyway. If the program is started with this setting pre-determined and persisting then there is quite literally nothing to intercept.
If it is a program that you have yourself programmed then it would clearly make more sense to add a feature which externalises the setting in some way rather than finding an arcane method for intercepting it.
Re: Need guidance on hooks
I see, it is a 3rd party software that my company I intern for uses. And for the setting it is basically a switch to initialize analyses that the program does.
The general direction I feel like I should be going towards is:
check to see if I can find a unique message from turning the setting on/off (using Spy++?) -> compile code for a thread specific hook (such as WH_CALLWNDPROC(ET) or WH_GETMESSAGE) -> If then statement for what to do when setting is on
I am thinking about getting the book, Subclassing and Hooking by Stephen Teilbet unless there is a better book someone recommends. This project isn't a top priority right now but I would like to finish it within the next 2 month before my internship ends.
Re: Need guidance on hooks
Quote:
Subclassing and Hooking
I wouldn't. It's hopelessly outdated and thus even more absurdly overpriced than the rest of the O'Reilly catalogue. Almost all of the 'tricks' described within it can now be done in native VB anyway.
Re: Need guidance on hooks
Thanks just relaize the book is from 2001, more than a decade ago!
Any recommendation on another reference? and am I on the right track with my thought process above?
Re: Need guidance on hooks
Off the top of my head, I don't know of any suitable reference. Truth is, with the improvements and additions to VB.Net over the years hooks, though certainly not extinct, are rarely used these days. If anything can be done your approach is as good a way as any of discovering it.