1
votes

Is it possible to control or redirect the WM_NCCalcSize and WM_NCHitTest events of a form from within a procedure of a custom component?

I have already been able to redirect the Paint and Resize events of the form but now I need to handle the WM_NCCalcSize and WM_NCHitTest events from procedures of a custom component.

These procedures control the size of the Caption bar on the form or simply hide it.

1

1 Answers

1
votes

Those messages are sent directly to the Form's window procedure. So the component would have to subclass the Form to intercept them. For instance, by using the GetParentForm() function to get a pointer to the Form, and then replacing its WindowProc property with a custom handler.