I have been studying some of my own recent threads concerning this, but have been unable to understand why some controls "refuse" to be sublassed.

For example, if I set the GWL_WNDPROC parameter of an ragrid control using SetWindowLong, I still don't intercept mouse events associated with this control.

Most controls work fine with my technique except a few such as ragrid and combobox don't respond.

I thought that setting the GWL_WNDPROC parameter of a control would vector ALL events intended for this control to the intercept proc.
Posted on 2004-07-25 17:57:28 by msmith
probably these controls actually also set the GWL_WNDPROC internally at some time after you have set it - check if your subclassing callback proc actually receives any messages.
Posted on 2004-07-25 18:27:01 by Ultrano
Ultrano,

To try your suggestion, I turn a static to a different color in the intercept handler. The color does change.

On a "normal" or well behaved control I get the following events trapped:

mousemove: wmsg=512
mousedown: wmsg=513
mouseup: wmsg=514

On ragrid I get:

mousemove: wmsg=160 or 32
mousedown: wmsg=1042 or 1043
mouseup: wmsg=never get it

Any idea what is happening?
Posted on 2004-07-25 23:44:43 by msmith
the reason for COMBOBOX is probably, that this window consists of more than one window. If you want to subclass the edit control inside the combo, you probably will need to get a HWND of the edit window first, than subclass it. I dont know the "ragrid" control, but maybe its the same problem...
Posted on 2004-07-27 06:26:24 by beaster
Hi Mike,

Many multipart controls will subclass the main window when they need to create a child for a specific task. For example if you are creating an edit control for input and destroying it when done. When it does so the subclassing routines are usually called in a daisy chain beginning with the most recently applied one. Each routine stores the value of the old WndProc and calls it when it is done with CallWindowProc, the old WndProc address corresponds to the next subclassing routine in the chain. However, in some cases the subclass proc will simply return without executing a CallWindowProc, in those cases any subclass procedures further down the chain will not recieve the message. If you are having trouble with a particular message you may try a local message hook.
Posted on 2004-07-27 10:03:34 by donkey