//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop

#include "PPSaver_SimpleDemo_.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "Ppsaver"
#pragma resource "*.dfm"
TForm1 *Form1;

const char* CLSID_AVIMux = "{E2510970-F137-11CE-8B67-00AA00A3F1A6}";

//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::btnAVIMuxClick(TObject *Sender)
{
   IUnknown *pUnk;
   GUID IntfGUID;


   // if "Call to undefined function StringToGUID" error, simply recompile the project.
   IntfGUID = StringToGUID (CLSID_AVIMux);

   if (CoCreateInstance(IntfGUID, NULL, CLSCTX_INPROC_SERVER || CLSCTX_LOCAL_SERVER, IID_IUnknown, (void **) &pUnk) == S_OK ) {
      if (PropertyPageSaver->Activate (pUnk)) {   // if the dialog has been sucessfully activated
         PropertyPageSaver->RestoreProperties();  // we restore the previous values
         if (PropertyPageSaver->ShowDialog()) {   // we show the dialog
            PropertyPageSaver->SaveProperties();  // we save the new values
         }
         PropertyPageSaver->Deactivate();         // and finally we deactivate the dialog
   }
   }
}
//---------------------------------------------------------------------------

void __fastcall TForm1::PropertyPageSaverPropertiesRestored(
      TObject *Sender)
{
   StatusBar1->SimpleText = "Properties restored from: " + PropertyPageSaver->GetFullRegistryPath();
}
//---------------------------------------------------------------------------

void __fastcall TForm1::PropertyPageSaverPropertiesSaved(TObject *Sender)
{
   StatusBar1->SimpleText = "Properties saved at: " + PropertyPageSaver->GetFullRegistryPath();
}
//---------------------------------------------------------------------------

