How can I subclass a PropertySheet based dialog box?

...or, how can I set up a function to be called every time the "Apply" button is pressed, regardless of which page enabled the button.
Posted on 2002-09-11 08:01:07 by The Worrier King
just give every apply button the same name/label in your resource>*.rc file, compile it and look for the same name/label in your windows message loop.

Posted on 2002-09-12 03:34:00 by eisodur
Not quite that simple...

A property sheet acts as a collection of independant dialog boxes inside a single window. You know, like the "Dispaly Properites" dialog, accessable from the control panel. Each "page" has it's own dialog proc, and message loop, but they're all controlled by a single Uber Message Loop, in the property sheet's "space". There's only one apply button, and the Uber Proc keeps track of which pages have changed, then sends the appropriate messages to that page's proc, when it's pressed (Apply that is).

I want to trigger an action whenever the apply button is clicked, regardless of which page made the change.

The Uber Proc is a common control, so I can't see the inner workings. The standard subclassing method won't work, because the whole thing is launched by a special function "PropertySheet", rather than "CreateWindowEX"
Posted on 2002-09-12 10:42:44 by The Worrier King
Try one of these:
1. Use the same dialog procedure for every page (not always applicable)
2. Write a function HandleApplyButtonClick() and call it in every dialog procedure as soon as you receive a click from the Apply button.
I hope to have understood correctly your question :grin:.
Posted on 2002-09-12 15:44:30 by LuHa