|
-
Jun 14th, 2013, 09:46 AM
#1
Thread Starter
New Member
Need guidance on hooks
Hello VBfourms,
I am new to visual basic and well programming in general although I have had an introductory class in C programming. I am using Visual Basic 2010 to make a tool that can monitor a computer that is being used either by a user at the desktop or sometimes remotely. 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.
I guess I need a push in the right direction. So far to my understanding I need to use a thread specific hook to check for application for a message from the program/window/thread? That says I have turned on the setting. Then when it is turned on I can enable my timer. The hook that I need to use is either WH_CALLWNDPROC(ET) or WH_GETMESSAGE. I am still learning more about hooks and playing around with spy++.
Am I on the right path? Which hook would be better to use? I would also appreciate any examples in a situation similar to mine. Any other advice is welcomed too. Thank you
-
Jun 15th, 2013, 03:25 AM
#2
New Member
Re: Need guidance on hooks
you can find it on http://www.pinvoke.net, there much samples about native windows api.
-
Jun 18th, 2013, 10:55 AM
#3
Thread Starter
New Member
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.
-
Jun 18th, 2013, 11:03 AM
#4
Re: Need guidance on hooks
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.
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Jun 19th, 2013, 08:11 AM
#5
Thread Starter
New Member
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.
-
Jun 19th, 2013, 02:00 PM
#6
Re: Need guidance on hooks
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.
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Jun 20th, 2013, 07:46 AM
#7
Thread Starter
New Member
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?
-
Jun 20th, 2013, 10:27 AM
#8
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.
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|