How to stop prevent an OptionsPage to close in .Apply Event?

Add-in Express™ Support Service
That's what is more important than anything else

How to stop prevent an OptionsPage to close in .Apply Event?
Andrei Jugovic

Posts: 59
Joined: 2007-02-08

I figured out, that I can use the .Apply event of my OptionsPage to check the changed the options and save them.

But what do I have to do when some of the options are wrong. Sure, I a can notice that and show a Message like "Please change value XY to a valide value...". But if the user had clicked on "OK" the options dialoge will close anyway... How can I prevent that, so that the user has to make the necessary changes first?

Posted 15 Mar, 2007 07:11:09 Top
Dmitry Kostochko

Add-in Express team

Posts: 2880
Joined: 2004-04-05
Hi Andrei,

You can return E_FAIL instead of S_OK:

function TMyOptionsPage.Apply: HResult;
  if not CheckSomeConditions() then
    Result := E_FAIL
  else begin
    FDirty := False;
    Result := S_OK;

P.S. Note that we take up your forum requests in the order we receive them.
Besides, it may take us some time to investigate your issue. Please be sure we will let you know as soon as the best possible solution is found.

Posted 15 Mar, 2007 10:14:12 Top