{وووووووووووووووووووووووووووووووووووووووووو}
{   \\\                                    }
{  -(j)-                                   }
{    /juanca                               }
{    ~                                     }
{$D © ACASA 1989-1992, All rights reserved }
{وووووووووووووووووووووووووووووووووووووووووو}

{ tMyOpenDlg, this is how to override tFileNameDlg, to set your own file specs, extensions
  dialog looks, etc.
}

UNIT MYOPEN_;
{$C MOVEABLE DEMANDLOAD DISCARDABLE}
INTERFACE
  USES
    FNAMEDLG;


  { the following dialog is a CommonFileDialog,
    it overrides file specification for .WAV files}
TYPE
  pMyOpenDlg = ^tMyOpenDlg;
  tMyOpenDlg = OBJECT(tFileNameDlg)

      option :Word;

      FUNCTION
      defSpec :PChar;
        virtual;

      FUNCTION
      defExt :PChar;
        virtual;

      FUNCTION
      defSpecPos:Byte;
        virtual;

      FUNCTION
      openFlags :Longint;
        virtual;

      FUNCTION
      canClose :bOOLEAN;
        virtual;
  END;

IMPLEMENTATION
  USES
    WINPROCS; { to getDlgItemChecked }
    {$I CDLG.INC }

      FUNCTION
      tMyOpenDlg.
      {}
      defSpec :PChar;
        begin
          { two file specifications, just to show it off,
            ALL #0 ARE NEEDED, specs in () only for user information
          } 
          defSpec := 'SoundFiles (*.wav)'#0'*.wav'#0'Joke Files (*.jok)'#0'*.jok'#0
        end;

      FUNCTION
      tMyOpenDlg.
      {}
      defExt :PChar;
        begin
          { default extension for files without one,
            rembember NO DOT (.)
          }
          defExt := 'wav'
        end;

      FUNCTION
      tMyOpenDlg.
      {}
      defSpecPos:Byte;
        begin
          defSpecPos := 2  { just to show how to use this method }
        end;

      FUNCTION
      tMyOpenDlg.
      {}
      openFlags :Longint;
        begin
          { here go OFN_XXX flags, change if you like }
          openFlags := tFileNameDlg.openFlags  
        end;

      FUNCTION
      tMyOpenDlg.
      {}
      canClose :bOOLEAN;
        begin
          canClose := tFileNameDlg.canClose;
          if isDlgButtonChecked(hwindow, id_Superb) <> 0
          then
            option := id_Superb
          else if isDlgButtonChecked(hwindow, id_JustOk) <> 0
          then
            option := id_JustOk
          else
            option := id_YourOwn
        end;
END.
