StarLiteMike
September 27th, 1999, 10:20 PM
I am new to this site so please accept my appologies in advance if this has been covered. I am basically looking for reference materials about this subclassing stuff I keep seeing. I have never heard of this in any of the books I have been reading, then I come here and start looking at the examples and everyone seems to be subclassing. Can some one please recommend a good reference/tutorial about this topic for me. I use VC++ 6.0. Thanks
Mike
Neo
September 28th, 1999, 10:25 AM
I don't do much C++ but I have used subclassing with straight C and it's not the black art it seems. I have used two methods of subclassing, firstly by restting the Window long of another app. This is done using the function SetWindowLong(). Use this function to reset the applications Callback function to one you have defined. Store the offset of the original Callback function, returned by SetWindowLong(), and any messages you don't want to deal with you simply pass back on to the original PROC. The only problem with this is you may run into security problems on NT.
The other method, which I suppose strictly isn't subclassing, is to use hooks to capture messages which you can then process before the target window gets them. If you have a look at SetWindowsHookEx() it should tell you everything you need to know.
Also www.msdn.microsoft.com has some good stuff.
Hope this helped
neo