IPropertyPage Apply block closing of dialog - ArcGIS Desktop

Discussion created by chrismorganlynx on Mar 13, 2012
Latest reply on Oct 9, 2012 by pathw0rk3r
Hi all,

I am writing ArcGIS Desktop extensions.
I have created a new IPropertyPage object to supply a new tab in the Layer Properties dialog in ArcMap.
I am now trying to validate these properties before the dialog closes - I would like to intercept the OK/Apply in some way.

Raising an exception in the IPropertyPage.Apply method does not stop the dialog closing.
I have also tried intercepting the PSN_KILLACTIVATE notification method using 2 different methods:
- by hooking the dialog's WndProc using SetWindowsHookEx with a WH_CALLWNDPROC hook
- by subclassing the dialog proc using SetWindowLong DWL_DLGPROC
Using both methods I can catch the PSN_KILLACTIVATE message, but I cannot stop the dialog from closing.
Is there a formal method for property validation before the dialog closes, or do I have to continue hacking around until I find a fix?

Thanks for any suggestions,