Test Foro de elhacker.net SMF 2.1

Programación => .NET (C#, VB.NET, ASP) => Programación General => Programación Visual Basic => Mensaje iniciado por: ricardovinzo en 26 Noviembre 2008, 23:03 PM

Título: una pregunta sobre hooks..
Publicado por: ricardovinzo en 26 Noviembre 2008, 23:03 PM
Buenas, bueno estuvel leyendo acerca de estos objetos.. pero no me queda algo claro..

cual es la diferencia entre SubClassing y los Hooks??
Título: Re: una pregunta sobre hooks..
Publicado por: cobein en 29 Noviembre 2008, 07:46 AM
http://www.vbaccelerator.com

1. Hooks Compared to Sub-Classing

Essentially a Windows Hook is like a subclass except it applies at the next point up in the message chain. In Win32, messages are queued and sent to the appropriate window via the WindowProc function. A subclass can intercept messages by replacing the existing WindowProc function with a new one.

With a Hook, you get to see all messages before Windows has decided which WindowProc procedure to direct the message to. You can modify or discard most messages at this point too. So using the Hook technique you not only get to act on messages at the highest point; you can also get at messages regardless of which window the message is intended for. This is very useful if you want to process Keyboard or Mouse messages on a global basis in your application, because these messages are normally directed to the window with the focus. If you tried to do the same thing using Subclassing then you would have to subclass every single window handle in your application to follow the mouse events. Using a Hook, the process is simple!