home *** CD-ROM | disk | FTP | other *** search
/ Software Recommendations - 1998 Season 1 / DNBCD4.iso / develop / lib / addzip / ADDZIP.ZIP / DELPHI / ZIPWIZ / ZWIZ.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1997-08-15  |  20.9 KB  |  787 lines

  1. unit Zwiz;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, ExtCtrls, StdCtrls, Buttons, FileCtrl, azip, addzipu, addzipc;
  8.  
  9. type
  10.   TfrmWizard = class(TForm)
  11.     imgWizard: TImage;
  12.     grpStep1: TGroupBox;
  13.     lblArchiveName: TLabel;
  14.     edtArchive: TEdit;
  15.     shpLine: TShape;
  16.     btnCancel: TSpeedButton;
  17.     btnBack: TSpeedButton;
  18.     btnNext: TSpeedButton;
  19.     btnFinish: TSpeedButton;
  20.     btnBrowse: TSpeedButton;
  21.     grpStep2: TGroupBox;
  22.     grpStep3: TGroupBox;
  23.     grpStep4: TGroupBox;
  24.     grpStep5: TGroupBox;
  25.     GroupBox1: TGroupBox;
  26.     grpPassword: TGroupBox;
  27.     grpCompression: TGroupBox;
  28.     radPathNo: TRadioButton;
  29.     radPathYes: TRadioButton;
  30.     radPasswordYes: TRadioButton;
  31.     radPasswordNo: TRadioButton;
  32.     lblPassword: TLabel;
  33.     edtPassword: TEdit;
  34.     radCompressNone: TRadioButton;
  35.     radCompressMinimum: TRadioButton;
  36.     radCompressNormal: TRadioButton;
  37.     radCompressMaximum: TRadioButton;
  38.     lblFiles: TLabel;
  39.     lstFiles: TFileListBox;
  40.     dirFiles: TDirectoryListBox;
  41.     drvFiles: TDriveComboBox;
  42.     btnAdd: TSpeedButton;
  43.     btnRemove: TSpeedButton;
  44.     lstSelected: TListBox;
  45.     grpMultiDisk: TGroupBox;
  46.     radMultiNo: TRadioButton;
  47.     radMultiYes: TRadioButton;
  48.     grpLFN: TGroupBox;
  49.     radLFNYes: TRadioButton;
  50.     radLFNNo: TRadioButton;
  51.     grpComment: TGroupBox;
  52.     radCommentNo: TRadioButton;
  53.     radCommentYes: TRadioButton;
  54.     mmoComment: TMemo;
  55.     mmoSummary: TMemo;
  56.     edtHidden: TEdit;
  57.     lblInfo: TLabel;
  58.     chkSFX: TCheckBox;
  59.     procedure btnCancelClick(Sender: TObject);
  60.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  61.     procedure FormShow(Sender: TObject);
  62.     procedure btnBackClick(Sender: TObject);
  63.     procedure btnNextClick(Sender: TObject);
  64.     procedure edtArchiveChange(Sender: TObject);
  65.     procedure btnFinishClick(Sender: TObject);
  66.     procedure btnAddClick(Sender: TObject);
  67.     procedure btnRemoveClick(Sender: TObject);
  68.     procedure lstFilesClick(Sender: TObject);
  69.     procedure dirFilesChange(Sender: TObject);
  70.     procedure radCommentNoClick(Sender: TObject);
  71.     procedure radCommentYesClick(Sender: TObject);
  72.     procedure radPasswordNoClick(Sender: TObject);
  73.     procedure radPasswordYesClick(Sender: TObject);
  74.     procedure btnBrowseClick(Sender: TObject);
  75.     procedure edtHiddenChange(Sender: TObject);
  76.   private
  77.     { Private declarations }
  78.     procedure AlignGroups;
  79.     procedure HideGroup(GroupNum : Integer);
  80.     procedure ShowGroup(GroupNum : Integer);
  81.     Function CheckFloppyDrives (cFileName : String) : Boolean;
  82.     procedure DisplaySummary;
  83.     function Trim(s : string) : string;
  84.     procedure WMGetMinMaxInfo(var MSG: Tmessage); message WM_GetMinMaxInfo;
  85.   public
  86.     { Public declarations }
  87.     procedure DOZip;
  88.   end;
  89.  
  90. {$IFDEF USE_CALLBACKS}
  91.   Type
  92.      {$IFNDEF WIN32} Short = ShortInt; {$ENDIF}
  93.      TProcessCallbackData = function (iLibrary, iMessage : Short; pInfo : PChar) : Integer;
  94.      {$IFDEF WIN32} stdcall; {$ENDIF}
  95.  
  96.  
  97.   function ProcessCallbackData(iLibrary, iMessage : Short; pInfo : PChar) : Integer;
  98.            {$IFDEF WIN32} stdcall; {$ENDIF} export;
  99. {$ENDIF}
  100.  
  101. var
  102.   frmWizard: TfrmWizard;
  103.   m_iStep : Integer;
  104.   {$IFDEF WIN32}
  105.   sArchiveName : String[255];
  106.   {$ELSE}
  107.   sArchiveName : String[128];
  108.   {$ENDIF}
  109.   {$IFDEF USE_CALLBACKS}
  110.   MyCallback : TProcessCallbackData;
  111.   {$ENDIF}
  112.   Const m_cMaxSteps = 5;
  113.  
  114. implementation
  115.  
  116. {$R *.DFM}
  117.  
  118. procedure TfrmWizard.btnCancelClick(Sender: TObject);
  119. begin
  120.    Close;
  121. end;
  122.  
  123. procedure TfrmWizard.FormClose(Sender: TObject; var Action: TCloseAction);
  124. begin
  125.    Action := caFree;
  126. end;
  127.  
  128. procedure TfrmWizard.FormShow(Sender: TObject);
  129. var
  130.    I: Integer;
  131. begin
  132.     I := addZIP_SetParentWindowHandle(frmWizard.Handle);
  133.     {$IFDEF Win32}
  134.     chkSFX.Enabled := False;
  135.     {$ELSE}
  136.     chkSFX.Enabled := True;
  137.     {$ENDIF}
  138.     {$IFDEF USE_CALLBACKS}
  139.     MyCallback := ProcessCallBackData;
  140.     I := addZip_InstallCallback(@MyCallback);
  141.     {$ELSE}
  142.     I := addZIP_SetWindowHandle(edtHidden.Handle);
  143.     {$ENDIF}
  144.     addZIP_Initialise;
  145.     m_iStep := 1;
  146.     AlignGroups;
  147.     grpStep1.Visible := True;
  148.     grpStep2.Visible := False;
  149.     grpStep3.Visible := False;
  150.     grpStep4.Visible := False;
  151.     grpStep5.Visible := False;
  152.     mmoSummary.Color := clBtnFace;
  153.  
  154. end;
  155.  
  156. procedure TfrmWizard.AlignGroups;
  157. begin
  158.    grpStep2.Top := GrpStep1.Top;
  159.    grpStep2.Left := GrpStep1.Left;
  160.    grpStep2.Width := GrpStep1.Width;
  161.    grpStep2.Height := GrpStep1.height;
  162.    grpStep3.Top := GrpStep1.Top;
  163.    grpStep3.Left := GrpStep1.Left;
  164.    grpStep3.Width := GrpStep1.Width;
  165.    grpStep3.Height := GrpStep1.height;
  166.    grpStep4.Top := GrpStep1.Top;
  167.    grpStep4.Left := GrpStep1.Left;
  168.    grpStep4.Width := GrpStep1.Width;
  169.    grpStep4.Height := GrpStep1.height;
  170.    grpStep5.Top := GrpStep1.Top;
  171.    grpStep5.Left := GrpStep1.Left;
  172.    grpStep5.Width := GrpStep1.Width;
  173.    grpStep5.Height := GrpStep1.height;
  174.  
  175. end;
  176.  
  177. procedure TfrmWizard.btnBackClick(Sender: TObject);
  178. begin
  179.     If (m_iStep > 1) Then
  180.        begin
  181.           HideGroup(m_iStep);
  182.           If (m_iStep = m_cMaxSteps) Then
  183.               btnNext.Enabled := True;
  184.           m_iStep := m_iStep - 1;
  185.           If (m_iStep = 1) Then
  186.               btnBack.Enabled := False;
  187.           ShowGroup(m_iStep);
  188.        End;
  189.  
  190. end;
  191.  
  192. procedure TfrmWizard.HideGroup(GroupNum : Integer);
  193. begin
  194.   case GroupNum of { which group to disable }
  195.   1 : begin
  196.          grpStep1.Visible := False
  197.       end;
  198.   2 : begin
  199.          grpStep2.Visible := False
  200.       end;
  201.   3 : begin
  202.          grpStep3.Visible := False
  203.       end;
  204.   4 : begin
  205.          grpStep4.Visible := False
  206.       end;
  207.   5 : begin
  208.          grpStep5.Visible := False
  209.       end;
  210.   end; { case }
  211. end;
  212.  
  213. procedure TfrmWizard.ShowGroup(GroupNum : Integer);
  214. begin
  215.   case GroupNum of { which group to disable }
  216.   1 : begin
  217.          grpStep1.Visible := True
  218.       end;
  219.   2 : begin
  220.          grpStep2.Visible := True
  221.       end;
  222.   3 : begin
  223.          grpStep3.Visible := True
  224.       end;
  225.   4 : begin
  226.          grpStep4.Visible := True
  227.       end;
  228.   5 : begin
  229.          grpStep5.Visible := True
  230.       end;
  231.   end; { case }
  232. end;
  233.  
  234. procedure TfrmWizard.btnNextClick(Sender: TObject);
  235. begin
  236.  
  237.  
  238.     If (m_iStep < m_cMaxSteps) Then
  239.        begin
  240.           HideGroup(m_iStep);
  241.           If (m_iStep = 1) Then
  242.               btnBack.Enabled := True;
  243.               If (Pos(':', edtArchive.Text) > 0) Then
  244.                  begin
  245.                     If CheckFloppyDrives(edtArchive.Text) = False Then
  246.                        begin
  247.                           grpMultiDisk.Enabled := False;
  248.                           radMultiNo.Enabled := False;
  249.                           radMultiYes.Enabled := False;
  250.                        end
  251.                     Else
  252.                         begin
  253.                            grpMultiDisk.Enabled := True;
  254.                            radMultiNo.Enabled := True;
  255.                            radMultiYes.Enabled := True;
  256.                         end
  257.                  end
  258.               Else
  259.                  begin
  260.                     grpMultiDisk.Enabled := False;
  261.                     radMultiNo.Enabled := False;
  262.                     radMultiYes.Enabled := False;
  263.                  End
  264.           End;
  265.           m_iStep := m_iStep + 1;
  266.           If (m_iStep = m_cMaxSteps) Then
  267.              begin
  268.                 btnNext.Enabled := False;
  269.                 DisplaySummary;
  270.              End;
  271.           ShowGroup(m_iStep);
  272.     End;
  273.  
  274.  
  275. Function TfrmWizard.CheckFloppyDrives (cFileName : String) : Boolean;
  276. var
  277.    {$IFDEF WIN32}
  278.    pFileName : PChar;
  279.    wResult : Word;
  280.    {$ELSE}
  281.    Drive : String;
  282.    DriveNumber, wResult : Word;
  283.    {$ENDIF}
  284. begin
  285.  
  286.    CheckFloppyDrives := False;
  287.  
  288.    {$IFDEF WIN32}
  289.    pFileName := StrAlloc(2);
  290.    StrPCopy(pFileName, Copy(UpperCase(cFileName), 1, 1));
  291.    wResult := GetDriveType(pFileName);
  292.    StrDispose(pFileName);
  293.    {$ELSE}
  294.    Drive := UpperCase(Copy(cFileName, 1, 1));
  295.    DriveNumber := Ord(Drive[1]) - 65;  {Drive must be upper case}
  296.    wResult := Word(GetDriveType(DriveNumber));
  297.    {$ENDIF}
  298.  
  299.    If wResult = DRIVE_REMOVABLE then
  300.       CheckFloppyDrives := True;
  301. End;
  302.  
  303. procedure TfrmWizard.DisplaySummary;
  304. var
  305.   sSummary, sResult : String;
  306.   I : Integer;
  307.   sFill : array[1..10] of Char;
  308. begin
  309.     sFill := '          ';
  310.     mmoSummary.Clear;
  311.  
  312.     sSummary := 'Compress the following ' + IntToStr(lstSelected.Items.Count) + ' file';
  313.     If (lstSelected.items.Count > 1) Then
  314.         sSummary := sSummary + 's';
  315.  
  316.    {$IFNDEF WIN32}
  317.    If chkSFX.State = cbChecked then
  318.       begin
  319.          sResult := ChangeFileExt(edtArchive.Text, '.exe');
  320.          sSummary := sSummary + ' to the archive ' + sResult + '.';
  321.       end
  322.    Else
  323.       sSummary := sSummary + ' to the archive ' + edtArchive.Text + '.';
  324.    {$ELSE} 
  325.    sSummary := sSummary + ' to the archive ' + edtArchive.Text + '.';
  326.    {$ENDIF}
  327.  
  328.     mmoSummary.Lines.Add(sSummary);
  329.     mmoSummary.Lines.Add('');
  330.  
  331.     For I := 0 To lstSelected.items.Count - 1 do
  332.         begin
  333.            sSummary := sFill + lstSelected.Items[I];
  334.            mmoSummary.Lines.Add(sSummary);
  335.         end;
  336.  
  337.     mmoSummary.Lines.Add('');
  338.  
  339.     sSummary := 'Selected options ';
  340.     mmoSummary.Lines.Add(sSummary);
  341.  
  342.     If (radPathYes.Checked = True) Then
  343.         sSummary := sFill + 'Full path information saved'
  344.     Else
  345.         sSummary := sFill + 'Only filenames saved';
  346.  
  347.     mmoSummary.Lines.Add(sSummary);
  348.  
  349.     If (radPasswordYes.Checked = True) Then
  350.         sSummary := sFill + 'Files will be encrypted'
  351.     Else
  352.         sSummary := sFill + 'Files will not be encrypted';
  353.  
  354.     mmoSummary.Lines.Add(sSummary);
  355.  
  356.     If (radCompressNone.Checked = True) Then
  357.         sSummary := sFill + 'Files will be stored without compression'
  358.     Else If (radCompressMinimum.Checked = True) Then
  359.         sSummary := sFill + 'Files will hame minimum compressed'
  360.     Else If (radCompressNormal.Checked = True) Then
  361.         sSummary := sFill + 'Files will have normal compression'
  362.     Else
  363.         sSummary := sFill + 'Files will have maximum compression';
  364.  
  365.     mmoSummary.Lines.Add(sSummary);
  366.  
  367.     If (radMultiYes.Checked = True) Then
  368.         sSummary := sFill + 'Archive may span multiple disks'
  369.     Else
  370.         sSummary := sFill + 'Archive will not span disks';
  371.  
  372.     mmoSummary.Lines.Add(sSummary);
  373.  
  374.     If (radLFNYes.Checked = True) Then
  375.         sSummary := sFill + 'Long filenames will be stored'
  376.     Else
  377.         sSummary := sFill + 'Short (8.3) filenames will be stored';
  378.  
  379.     mmoSummary.Lines.Add(sSummary);
  380.  
  381.     If (radCommentYes.Checked = True) Then
  382.        begin
  383.           sSummary := sFill + 'Archive will have a comment added';
  384.           mmoSummary.Lines.Add(sSummary);
  385.        end;
  386. end;
  387.  
  388. procedure TfrmWizard.edtArchiveChange(Sender: TObject);
  389. begin
  390.     If (Length(edtArchive.Text) = 0) Then
  391.         btnNext.Enabled := False
  392.     Else
  393.         btnNext.Enabled := True;
  394. end;
  395.  
  396. {Supresses leading and trailing blanks}
  397. function TfrmWizard.Trim(s : string) : string;
  398. var
  399.   sLen : byte absolute s;
  400. begin
  401.   while (sLen>0) and (s[1] in [' ',^I]) do
  402.     Delete(s,1,1);
  403.  
  404.   while (sLen>0) and (s[sLen] in [' ',^I]) do
  405.     Dec(sLen);
  406.  
  407.   result:=s;
  408. end;
  409.  
  410. procedure TfrmWizard.btnFinishClick(Sender: TObject);
  411. var
  412.    iResult : Integer;
  413.    pMsg : PChar;
  414. begin
  415.    pMsg := StrAlloc(40);
  416.  
  417.    If (grpStep5.Visible = False) Then
  418.        begin
  419.           DisplaySummary;
  420.           HideGroup(m_iStep);
  421.           ShowGroup(m_cMaxSteps);
  422.           m_iStep := m_cMaxSteps;
  423.        End;
  424.  
  425.    StrCopy(pMsg, 'You are about to start creating the archive.' +  #13#13 + 'Press OK to proceed, Cancel to quit.');
  426.    iResult := Application.MessageBox(pMsg, 'Zip Wizard', MB_APPLMODAL + MB_OKCANCEL + MB_ICONQUESTION);
  427.    If iResult = IDOK then
  428.       begin
  429.          sArchiveName := edtArchive.Text;
  430.          DOZIP;
  431.       end;
  432.  
  433.    StrCopy(pMsg, 'Finished creating archive.');
  434.    iResult := Application.MessageBox(pMsg, 'Zip Wizard', MB_APPLMODAL + MB_OK + MB_ICONINFORMATION);
  435.  
  436.    StrDispose(pMsg);
  437.  
  438.    Close;
  439. end;
  440.  
  441. procedure TfrmWizard.btnAddClick(Sender: TObject);
  442. var
  443.    sFilename : String;
  444. begin
  445.     sFilename := lstFiles.Filename;
  446.     lstSelected.Items.Add(LowerCase(sFilename));
  447.     If (lstSelected.items.Count = 1) Then
  448.        begin
  449.           btnNext.Enabled := True;
  450.           btnFinish.Enabled := True;
  451.           btnRemove.Enabled := True;
  452.        end;
  453.  
  454. end;
  455.  
  456. procedure TfrmWizard.btnRemoveClick(Sender: TObject);
  457. begin
  458.     lstSelected.Items.Delete(lstSelected.ItemIndex);
  459.     If (lstSelected.Items.Count = 0) Then
  460.        begin
  461.           btnNext.Enabled := False;
  462.           btnFinish.Enabled := False;
  463.           btnRemove.Enabled := False;
  464.        End;
  465.  
  466. end;
  467.  
  468. procedure TfrmWizard.lstFilesClick(Sender: TObject);
  469. begin
  470.    btnAdd.Enabled := True;
  471. end;
  472.  
  473. procedure TfrmWizard.dirFilesChange(Sender: TObject);
  474. begin
  475.    btnAdd.Enabled := False;
  476. end;
  477.  
  478. procedure TfrmWizard.radCommentNoClick(Sender: TObject);
  479. begin
  480.     If (radCommentNo.Checked = True) Then
  481.         mmoComment.Enabled := False;
  482. end;
  483.  
  484. procedure TfrmWizard.radCommentYesClick(Sender: TObject);
  485. begin
  486.     If (radCommentYes.Checked = True) Then
  487.        mmoComment.Enabled := True;
  488. end;
  489.  
  490. procedure TfrmWizard.radPasswordNoClick(Sender: TObject);
  491. begin
  492.     If (radPasswordNo.Checked = True) Then
  493.        begin
  494.           edtPassword.Enabled := False;
  495.           lblPassword.Enabled := False;
  496.        End;
  497. end;
  498.  
  499. procedure TfrmWizard.radPasswordYesClick(Sender: TObject);
  500. begin
  501.     If (radPasswordYes.Checked = True) Then
  502.        begin
  503.           edtPassword.Enabled := True;
  504.           lblPassword.Enabled := True;
  505.        End;
  506. end;
  507.  
  508. procedure TfrmWizard.btnBrowseClick(Sender: TObject);
  509. begin
  510.  
  511.    with TOpenDialog.Create(Self) do
  512.    try
  513.       Title := 'Enter a name for a .ZIP archive';
  514.       Filename := '';
  515.       InitialDir := ExtractFilepath(Application.ExeName);
  516.       DefaultExt := '.ZIP';
  517.       Filter := 'ZIP Files (*.ZIP)|*.ZIP|All Files (*.*)|*.*';
  518.       FilterIndex := 1;
  519.       HelpContext := 0;
  520.       Options := Options + [ofPathMustExist];
  521.  
  522.       if Execute then
  523.          begin
  524.             If Trim(Filename) <> '' Then
  525.                edtArchive.Text := Filename
  526.             Else
  527.                edtArchive.Text := '';
  528.          End
  529.       Else
  530.          edtArchive.Text := ''
  531.    finally
  532.      Free
  533.    end;
  534.  
  535. end;
  536.  
  537. procedure TfrmWizard.WMGetMinMaxInfo(var MSG: Tmessage);
  538. Begin
  539.   inherited;
  540.   with PMinMaxInfo(MSG.lparam)^ do
  541.   begin
  542.     with ptMaxTrackSize do
  543.     begin
  544.       X := 504;
  545.       Y := 440;
  546.     end;
  547.     with ptMinTrackSize do
  548.     begin
  549.       X := 504;
  550.       Y := 440;
  551.     end;
  552.   end;
  553. end;
  554.  
  555. procedure TfrmWizard.DOZip;
  556. var
  557.    {$IFDEF WIN32}
  558.    sTempFile : String[255];
  559.    {$ELSE}
  560.    sTempFile : String[128];
  561.    {$ENDIF}
  562.    sResult : String;
  563.    pPassWord, pTempFile, pArchiveName, pFiles : PChar;
  564.    I : Integer;
  565. begin
  566.  
  567.    pFiles := StrAlloc(65526);
  568.    {$IFDEF WIN32}
  569.    pArchiveName := StrAlloc(255);
  570.    pTempFile := StrAlloc(255);
  571.    {$ELSE}
  572.    pArchiveName := StrAlloc(127);
  573.    pTempFile := StrAlloc(127);
  574.    {$ENDIF}
  575.  
  576.    {$IFNDEF WIN32}
  577.    If chkSFX.State = cbChecked then
  578.       begin
  579.          i := addZIP_BuildSFX(True);
  580.          sResult := ChangeFileExt(sArchiveName, '.EXE');
  581.          sArchiveName := sResult;
  582.       end;
  583.    {$ENDIF}
  584.     { Set the name of the archive}
  585.    StrPCopy(pArchiveName, sArchiveName);
  586.    I := addZIP_ArchiveName(pArchiveName);
  587.  
  588.    pFiles := '';
  589.    { Create pipe-delimited list of files and call the appropriate function}
  590.    For I := 0 To lstSelected.Items.Count - 1 do
  591.        begin
  592.           sTempFile := Trim(lstSelected.Items[I]) + '|';
  593.           StrPCopy(pTempFile, sTempFile);
  594.           StrCat(pFiles, pTempFile);
  595.        end;
  596.  
  597.    I := addZIP_Include(pFiles);
  598.  
  599.    If (radPathYes.Checked = True) Then
  600.        I := addZIP_SaveStructure(azSTRUCTURE_ABSOLUTE)
  601.    Else
  602.        I := addZIP_SaveStructure(azSTRUCTURE_RELATIVE);
  603.  
  604.    If (radPasswordYes.Checked = True) Then
  605.       begin
  606.          pPassWord := StrAlloc(Length(edtPassword.Text) + 1);
  607.          StrPCopy(pPassWord, edtPassword.Text);
  608.          I := addZIP_Encrypt(pPassword);
  609.          StrDispose(pPassWord);
  610.       end;
  611.  
  612.    If (radCompressNone.Checked = True) Then
  613.        I := addZIP_SetCompressionLevel(azCOMPRESSION_NONE)
  614.    Else If (radCompressMinimum.Checked = True) Then
  615.        I := addZIP_SetCompressionLevel(azCOMPRESSION_MINIMUM)
  616.    Else If (radCompressNormal.Checked = True) Then
  617.        I := addZIP_SetCompressionLevel(azCOMPRESSION_NORMAL)
  618.    Else
  619.        I := addZIP_SetCompressionLevel(azCOMPRESSION_MAXIMUM);
  620.  
  621.    If (radMultiYes.Checked = True) Then
  622.        I := addZIP_Span(True)
  623.    Else
  624.        I := addZIP_Span(False);
  625.  
  626.    If (radLFNYes.Checked = True) Then
  627.        I := addZIP_UseLFN(True)
  628.    Else
  629.        I := addZIP_UseLFN(False);
  630.  
  631.    If (radCommentYes.Checked = True) Then
  632.       begin
  633.          I := addZIP_Comment(mmoComment.Lines.GetText);
  634.       end;
  635.  
  636.    I := addZIP;
  637.  
  638.    {StrDispose(pFiles);}
  639.    StrDispose(pArchiveName);
  640.    StrDispose(pTempFile);
  641. end;
  642.  
  643. {$IFDEF USE_CALLBACKS}
  644. function ProcessCallbackData(iLibrary, iMessage : Short; pInfo : PChar) : Integer;
  645.          {$IFDEF WIN32} stdcall; {$ENDIF}
  646. var
  647.    cAdditem : String;
  648. begin
  649.     With frmWizard do
  650.        Case iMessage of
  651.             AM_SEARCHING : begin
  652.                 {comment}
  653.                 end;
  654.             AM_ZIPCOMMENT : begin
  655.                 {comment}
  656.                  end;
  657.             AM_ZIPPING : begin
  658.                 cAdditem := ' Zipping ' + ExtractFileName(GetCompFileName(StrPas(pInfo)));
  659.                 cAdditem := cAdditem + ' - ' + GetPercentComplete(StrPas(pInfo));
  660.                 lblInfo.Caption := cAdditem;
  661.                 lblInfo.Update;
  662.                 end;
  663.             AM_ZIPPED : begin
  664.                 {comment}
  665.                  end;
  666.             AM_UNZIPPING : begin
  667.                 {comment}
  668.                  end;
  669.             AM_UNZIPPED : begin
  670.                 {comment}
  671.                  end;
  672.             AM_TESTING : begin
  673.                 {comment}
  674.                  end;
  675.             AM_TESTED : begin
  676.                 {comment}
  677.                  end;
  678.             AM_DELETING : begin
  679.                 {comment}
  680.                  end;
  681.             AM_DELETED : begin
  682.                 {comment}
  683.                  end;
  684.             AM_DISKCHANGE : begin
  685.                {comment}
  686.                 end;
  687.             AM_VIEW : begin
  688.                {comment}
  689.                 end;
  690.             AM_ERROR : begin
  691.                {error}
  692.                 end;
  693.             AM_WARNING : begin
  694.                {warning}
  695.                 end;
  696.             AM_QUERYOVERWRITE : begin
  697.                 {
  698.                 I have set the overwrite query option to default to NO to avoid a GPF
  699.                 when the replace dialog (from QuickZip) is displayed
  700.                 }
  701.                 {ProcessCallbackData := azOW_YES;}
  702.                 {ProcessCallbackData := azOW_YES_TO_ALL;}
  703.                 ProcessCallbackData := azOW_NO;
  704.                 {ProcessCallbackData := azOW_NO_TO_ALL;}
  705.  
  706.                 end;
  707.             AM_COPYING : begin
  708.             {comment}
  709.                 end;
  710.             AM_COPIED : begin
  711.             {comment}
  712.                 end;
  713.         end;
  714. end;
  715. {$ENDIF}
  716.  
  717. procedure TfrmWizard.edtHiddenChange(Sender: TObject);
  718. {$IFNDEF USE_CALLBACKS}
  719. var
  720.    cAdditem : String;
  721.    iAction : Integer;
  722. {$ENDIF}
  723. begin
  724. {$IFNDEF USE_CALLBACKS}
  725.     iAction := StrToInt(GetAction((edtHidden.Text)));
  726.  
  727.     Case iAction of
  728.         AM_SEARCHING : begin
  729.             {comment}
  730.             end;
  731.         AM_ZIPCOMMENT : begin
  732.             {comment}
  733.              end;
  734.         AM_ZIPPING : begin
  735.           cAdditem := 'Zipping ' + GetPiece((edtHidden.Text), '|', 4);
  736.           cAdditem := cAdditem + ' - ' + GetPercentComplete((edtHidden.Text));
  737.           lblInfo.Caption := cAdditem;
  738.           lblInfo.Update;
  739.             end;
  740.         AM_ZIPPED : begin
  741.             {comment}
  742.              end;
  743.         AM_UNZIPPING : begin
  744.             {comment}
  745.             end;
  746.         AM_UNZIPPED : begin
  747.             {comment}
  748.              end;
  749.         AM_TESTING : begin
  750.             {comment}
  751.              end;
  752.         AM_TESTED : begin
  753.             {comment}
  754.              end;
  755.         AM_DELETING : begin
  756.             {comment}
  757.              end;
  758.         AM_DELETED : begin
  759.             {comment}
  760.              end;
  761.         AM_DISKCHANGE : begin
  762.             {comment}
  763.              end;
  764.         AM_VIEW : begin
  765.             {comment}    
  766.            end;
  767.         AM_ERROR : begin
  768.             {error}
  769.              end;
  770.         AM_WARNING : begin
  771.             {warning}
  772.              end;
  773.         AM_QUERYOVERWRITE : begin
  774.             {comment}
  775.              end;
  776.         AM_COPYING : begin
  777.             {comment}
  778.              end;
  779.         AM_COPIED : begin
  780.             {comment}
  781.              end;
  782.     end;
  783. {$ENDIF}
  784. end;
  785.  
  786. end.
  787.