I have a third party component that displays a print preview form. I would like to change the caption of the preview form to something more appropriate. Unfortunately I do not have the source for the third party component and the component does not provide the functionality.
Is it possible to somehow catch the modal form as it is being displayed and set it’s properties before it is shown?
The modal form will cause the calling form to deactivate, you can listen for
WM_ACTIVATEmessages on the form that is active before the modal form is shown. You’ll have the activating window’s handle in the message handler, you can test that if it is of a form of the type of the modal form. Below example tests for the class name, which you can get with something like Spy++. Note that deactivation happens briefly after the modal form has become visible, but I don’t think it would be possible to notice the differing caption.