Subversion Repositories autosfx

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 daniel-mar 1
 (******************************************************************)
2
 (* SFX for DelZip v1.8                                            *)
3
 (* Copyright 1997, Microchip Systems / Carl Bunton                *)
4
 (* Email: Twojags@cris.com                                        *)
5
 (* Web-page: http://www.concentric.net/~twojags                   *)
6
 (*                                                                *)
7
 (* modified by Markus Stephany                                    *)
8
(* modified by Russell Peters, Roger Aelbrecht
9
  This library is free software; you can redistribute it and/or
10
  modify it under the terms of the GNU Lesser General Public
11
  License as published by the Free Software Foundation; either
12
  version 2.1 of the License, or (at your option) any later version.
13
 
14
  This library is distributed in the hope that it will be useful,
15
  but WITHOUT ANY WARRANTY; without even the implied warranty of
16
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17
  Lesser General Public License (licence.txt) for more details.
18
 
19
  You should have received a copy of the GNU Lesser General Public
20
  License along with this library; if not, write to the Free Software
21
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
22
 
23
  contact: problems AT delphizip DOT org
24
  updates: http://www.delphizip.org
25
 
26
  modified 8-Nov-2008
27
---------------------------------------------------------------------------*)
28
unit ZMSFXDialogs19;
29
 
30
{
31
this unit contains the dialog procedures of all sfx dialogs
32
and the select extract directory dialog wrapper
33
 
34
}
35
 
36
interface
37
 
38
uses Messages, Windows, ZMSFXDefs19, ZMSFXInt19, ZMSFXStrings19;
39
 
40
const
41
  SFX_Version ='1.9.0.0028';
42
 
43
{$I '..\ZipVers19.inc'}
44
 
45
// main dialog window procedure
46
function MainDialogProc(DlgWin: hWnd; DlgMessage: UINT; DlgWParam: WPARAM;
47
  DlgLParam: LPARAM): BOOL; stdcall;
48
 
49
// confirm overwriting
50
function FileExistsDialogProc(DlgWin: hWnd; DlgMessage: UINT;
51
  DlgWParam: WPARAM; DlgLParam: LPARAM): BOOL; stdcall;
52
 
53
// ask for password
54
function PasswordQueryDialogProc(DlgWin: hWnd; DlgMessage: UINT;
55
  DlgWParam: WPARAM; DlgLParam: LPARAM): BOOL; stdcall;
56
 
57
// ask for locale
58
function LanguageQueryDialogProc(DlgWin: hWnd; DlgMessage: UINT;
59
  DlgWParam: WPARAM; DlgLParam: LPARAM): BOOL; stdcall;
60
 
61
implementation
62
 
63
uses
64
  ZMSFXVars19, ZMSFXProcs19;
65
 
66
var
67
  // needed by browse for folder proc
68
  BrowseInfo: TBrowseInfo;
69
  DisplayName: array[0..MAX_PATH] of char;
70
  idBrowse: pItemIDList;
71
 
72
// callback proc for shbrowseforfolder
73
 
74
function BrowseCBProc(HWindow: HWND; uMsg: integer; lParameter: LPARAM;
75
  lpBrowseFolder: LPARAM): integer; stdcall;
76
begin
77
  Result := 0;
78
  case uMsg of
79
    BFFM_INITIALIZED:
80
    begin
81
      // set the current path
82
      SendMessage(HWindow, BFFM_SETSELECTION, 1, lpBrowseFolder);
83
      SetWindowText(HWindow, pChar(SFXString(SFX_Cap_Browse)));
84
    end;
85
    BFFM_SELCHANGED:
86
    begin
87
      // test if the currently selected path is a valid file-system path
88
      if not SHGetPathFromIDList(PItemIDList(lParameter), DisplayName) then
89
        EnableWindow(GetDlgItem(HWindow, idOk), False);
90
    end;
91
  end;
92
end;
93
 
94
// browse for a directory using shell32 api
95
function BrowseDirectory(Parent: HWND; var sPath: string): boolean;
96
//{$IFDEF DELPHI3UP}
97
var
98
  ppMalloc: IMalloc; // Lucjan Lukasik
99
//{$ENDIF}
100
begin
101
  Result := False;
102
 
103
  with BrowseInfo do
104
  begin
105
    hWndOwner := Parent;
106
    pidlRoot := nil;
107
    pszDisplayName := DisplayName;
108
    lpszTitle := pChar(SFXString(SFX_Cap_Browse));
109
    ulFlags := BIF_RETURNONLYFSDIRS or BIF_USENEWUI;
110
    lpfn := @BrowseCBProc;
111
    lParam := integer(PChar(sPath));
112
  end;
113
 
114
  idBrowse := SHBrowseForFolder(BrowseInfo);
115
 
116
  if Assigned(idBrowse) then
117
  begin
118
    // convert pidl to folder name
119
    SetLength(sPath, MAX_PATH * 2);
120
    SHGetPathFromIDList(idBrowse, PChar(sPath));
121
    sPath  := PChar(sPath); // match length
122
//    {$IFDEF DELPHI3UP}
123
    if (SHGetMalloc(ppMalloc) and $80000000) <> 0 then // Lucjan Lukasik
124
      // If error, then Exit;
125
      Exit; // Result = False
126
    ppMalloc.Free(idBrowse);
127
//    {$ENDIF}
128
    Result := True;
129
    ChDir(sPath);
130
  end;
131
end;
132
 
133
// FileExistsDialogProc --- Handle messages for file exists dialog.
134
function FileExistsDialogProc(DlgWin: hWnd; DlgMessage: UINT;
135
  DlgWParam: WPARAM; DlgLParam: LPARAM): BOOL; stdcall;
136
begin
137
  Result := True;
138
  case DlgMessage of
139
    WM_INITDIALOG:
140
    begin                      
141
      SetDlgStrings(DlgWin, SFX_DLG_FILE);
142
      SetDlgItemText(DlgWin, ID_EDITBOX,
143
        PChar(FmtStrID1(SFX_Msg_FileExists, VStr_CurrentFile)));
144
      SetFocus(GetDlgItem(DlgWin, ID_BTN_YES));
145
    end;
146
 
147
    WM_COMMAND:
148
      case LOWORD(DlgWParam) of
149
        ID_BTN_YES, ID_BTN_NO:
150
        begin
151
          (* No ask Overwrite again checked, show results in affected option buttons *)
152
          if IsDlgButtonChecked(DlgWin, ID_CB_NOASK) = BST_CHECKED then
153
            //SendMessage(GetDlgItem(DlgWin, ID_CB_NOASK), BM_GETCHECK, 0, 0) = 1 then
154
          begin
155
            CheckRadioButton(VH_MainWnd, ID_RB_OVERWRITE, ID_RB_CONFIRM,
156
              ID_RB_OVERWRITE + integer(LOWORD(DlgWParam) = ID_BTN_NO));    
157
            if LOWORD(DlgWParam) = ID_BTN_NO then
158
              VRec_SFXHeader.DefOVW := WORD(som_Skip)
159
            else
160
              VRec_SFXHeader.DefOVW := WORD(som_Overwrite);
161
//            VRec_SFXHeader.DefOVW := {TSFXOverwriteMode(}LOWORD(DlgWParam) = ID_BTN_NO{)};
162
              {(* Set confirm radiobutton to Unchecked *)
163
              SendMessage(GetDlgItem(VH_MainWnd, ID_RB_CONFIRM), BM_SETCHECK, 0, 0);
164
              if LOWORD(DlgWParam) = ID_BTN_YES then
165
              begin
166
                (* Set overwrite rb to checked *)
167
                SendMessage(GetDlgItem(VH_MainWnd, ID_RB_OVERWRITE), BM_SETCHECK, 1, 0);
168
                (* Don't ask for OverWrites *)
169
                VRec_SFXHeader.DefOVW := somOverwrite;
170
                //VBool_OverwriteFile := True;
171
              end
172
              else
173
              begin
174
                (* Set skip rb to checked *)
175
                SendMessage(GetDlgItem(VH_MainWnd, ID_RB_SKIP), BM_SETCHECK, 1, 0);
176
                (* Don't ask... skip *)
177
                VRec_SFXHeader.DefOVW := somSkip;
178
                //VBool_OverwriteFile := False;
179
              end;}
180
          end
181
            (*else if VRec_SFXHeader.DefOVW > somOverwrite then
182
              VBool_OverwriteFile := LOWORD(DlgWParam) = ID_BTN_YES*);
183
          EndDialog(DlgWin, LOWORD(DlgWParam));
184
          Exit;
185
        end;
186
      end;
187
  end;
188
  Result := False;
189
end;
190
 
191
// PasswordQueryDialogProc --- Handle messages for password dialog.
192
function PasswordQueryDialogProc(DlgWin: hWnd; DlgMessage: UINT;
193
  DlgWParam: WPARAM; DlgLParam: LPARAM): BOOL; stdcall;
194
begin
195
  case DlgMessage of
196
    WM_INITDIALOG:
197
    begin
198
        SetDlgStrings(DlgWin, SFX_DLG_PWRD);
199
      // set the caption to reflect the current file
200
      SetWindowText(DlgWin, PChar(
201
        FmtStr1(SFXString(SFX_Cap_Password), ExtractFileName(VStr_CurrentFile))));
202
      (* Set input focus to the first   *)
203
      (* edit field.                    *)
204
      SetFocus(GetDlgItem(DlgWin, ID_EDITBOX));
205
    end;
206
 
207
    WM_CLOSE:
208
    begin
209
      VStr_Password := '';
210
      EndDialog(DlgWin, idCancel);
211
    end;
212
    WM_COMMAND:
213
      case LOWORD(DlgWParam) of
214
        ID_EDITBOX:
215
          if HIWORD(DlgwParam) = EN_CHANGE then
216
          begin
217
            EnableWindow(GetDlgItem(DlgWin, ID_BTN_YES),
218
              GetWindowTextLength(DlgLParam) > 0);
219
          end;
220
        ID_BTN_YES:
221
        begin
222
          VStr_Password := Copy(AnsiString(StrGetEditText(DlgWin)), 1, MAX_PASSWORD);
223
          EndDialog(DlgWin, idOk);
224
        end;
225
        ID_BTN_NO:
226
        begin
227
          VStr_Password := '';
228
          EndDialog(DlgWin, idCancel);
229
        end;
230
      end;
231
  end;
232
  Result := False;
233
end;
234
 
235
// LanguageQueryDialogProc --- Handle messages for language dialog.
236
function LanguageQueryDialogProc(DlgWin: hWnd; DlgMessage: UINT;
237
  DlgWParam: WPARAM; DlgLParam: LPARAM): BOOL; stdcall;
238
var
239
  tmp: pChar;
240
begin
241
  case DlgMessage of
242
    WM_INITDIALOG:
243
    begin                            
244
      SetDlgStrings(DlgWin, SFX_DLG_LANG);
245
      SetWindowText(DlgWin, pChar(SFXString(SFX_Cap_App)));
246
//      SetDlgItemText(DlgWin, ID_LANG_SELECT, PChar(SFXString(SFX_Btn_Select)));
247
      // set the language names
248
      SetLangStrings(GetDlgItem(DlgWin, ID_LANG_COMBO));
249
    end;
250
 
251
    WM_CLOSE:
252
    begin
253
//      VStr_Lang := '';
254
      VInt_CurLang := 0;
255
      EndDialog(DlgWin, idCancel);
256
    end;
257
    WM_COMMAND:
258
      case LOWORD(DlgWParam) of
259
        ID_BTN_YES:
260
        begin
261
          tmp := pChar(GetXBuf(512));
262
          GetDlgItemText(DlgWin, ID_LANG_COMBO, tmp, 200);
263
          VInt_CurLang := SendMessage(GetDlgItem(DlgWin, ID_LANG_COMBO),
264
              CB_FINDSTRINGEXACT, 0, Integer(tmp));
265
          EndDialog(DlgWin, idOk);
266
        end;
267
        ID_BTN_NO:
268
        begin
269
//          VStr_Lang := '';
270
          VInt_CurLang := 0;
271
//          EndDialog(DlgWin, idCancel);
272
          EndDialog(DlgWin, LOWORD(DlgWParam));
273
        end;
274
      end;
275
  end;
276
  Result := False;
277
end;
278
 
279
// MainDialogProc --- Handle messages for main window dialog.
280
var
281
  // we are in extraction, so we maybe can cancel
282
  bInExtraction: boolean;
283
 
284
const
285
  // show/hide
286
  SHOW_CMD: array[False..True] of integer = (SW_SHOW, SW_HIDE);
287
 
288
  // controls to show on "show files" button press
289
  SHOW_CTRLS: array[0..1] of integer = (ID_ST_FILES, ID_LV_FILES);
290
 
291
  // controls to reposition on hiding overwrite/run controls
292
  POS_CTRLS_HIDE: array[0..5] of integer = (ID_BTN_SHOWFILES, ID_CB_RUN, ID_BTN_ABOUT,
293
    ID_BTN_YES, ID_BTN_NO, ID_EDGE_BOTTOM);
294
 
295
  // controls to reposition on pressing "Show files" button
296
  POS_CTRLS: array[0..9] of integer = (ID_ST_OVWGROUP, ID_RB_OVERWRITE,
297
    ID_RB_SKIP, ID_RB_CONFIRM, ID_BTN_SHOWFILES, ID_CB_RUN, ID_BTN_ABOUT,
298
    ID_BTN_YES, ID_BTN_NO, ID_EDGE_BOTTOM);
299
 
300
  // controls to show/hide on progress bar display/hiding
301
  SWAP_CTRLS: array[0..3] of integer = (ID_PRG_EXTRACT, ID_ST_EXTRACTTO,
302
    ID_EDITBOX, ID_BTN_BROWSE);
303
 
304
function MainDialogProc(DlgWin: hWnd; DlgMessage: UINT; DlgWParam: WPARAM;
305
  DlgLParam: LPARAM): BOOL; stdcall;
306
var
307
  cm1: integer;
308
  i: integer;
309
  bOK: boolean;            
310
  LIntSmaller: integer;
311
  tmp: string;
312
begin (* MainDialogProc *)
313
  Result := True;
314
  with VRec_SFXHeader do
315
    case DlgMessage of
316
      WM_INITDIALOG:
317
      begin
318
        (* Assign to a global *)
319
        VH_MainWnd := DlgWin;
320
        bInExtraction := False;
321
        VBool_Cancelled := False;
322
 
323
        SetDlgStrings(DlgWin, SFX_DLG_MAIN);
324
        (* Set the program's icon *)
325
        // may 11,2002: changed
326
        SendMessage(DlgWin, WM_SETICON, ICON_BIG, LoadIcon(hInstance, 'MNICON'));
327
 
328
        // add columns to the listview (name,path,size)
329
        AddFilesListViewCol(DlgWin, 0, SFXString(SFX_LVC_Filename), LVCFMT_LEFT, 200);
330
        AddFilesListViewCol(DlgWin, 1, SFXString(SFX_LVC_Filesize), LVCFMT_RIGHT, 70);
331
 
332
        // set image list
333
        SendDlgItemMessage(DlgWin, ID_LV_FILES, LVM_SETEXTENDEDLISTVIEWSTYLE,
334
          LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT);
335
        SendDlgItemMessage(DlgWin, ID_LV_FILES, LVM_SETIMAGELIST,
336
          LVSIL_SMALL, VH_ShellImageList);
337
 
338
        cm1 := GetDlgItem(DlgWin, ID_CB_RUN); // the run... checkbox
339
        if (VStr_SFX_CmdLine = '') or ((so_AskCmdLine and Options) = 0) then
340
          // Command Line
341
          DestroyWindow(cm1) //## no cmd-line, so hide the run... checkbox
342
        else
343
        begin
344
          //## give the run... checkbox a title
345
          SetWindowText(cm1, PChar(GetRunCheckBoxText));
346
 
347
          //## check it by default
348
          SendMessage(cm1, BM_SETCHECK, 1, 0);
349
        end;
350
        SetDlgItemText(DlgWin, ID_EDITBOX, PChar(VStr_ExtractPath));
351
        (* Hilite string in Edit1 control *)
352
        SendMessage(GetDlgItem(DlgWin, ID_EDITBOX), EM_SETSEL, 0, $7FFF);
353
 
354
        (* Set overwrite mode *)
355
        SendMessage(GetDlgItem(DlgWin, integer(DefOVW) + ID_RB_OVERWRITE),
356
          BM_SETCHECK, 1, 0);
357
        //## and calculate the command for the overwrite-mode
358
 
359
        LIntSmaller := 0;
360
        if (so_HideOverWriteBox and Options) <> 0 then
361
          //## if we do not want to select another overwrite-mode, destroy the controls
362
        begin
363
          LIntSmaller := 23;
364
          DestroyWindow(GetDlgItem(DlgWin, ID_RB_OVERWRITE));
365
          DestroyWindow(GetDlgItem(DlgWin, ID_RB_SKIP));
366
          DestroyWindow(GetDlgItem(DlgWin, ID_RB_CONFIRM));
367
          DestroyWindow(GetDlgItem(DlgWin, ID_ST_OVWGROUP));
368
        end;
369
 
370
        if (so_AskCmdLine and Options) = 0 then
371
        begin
372
          if LIntSmaller <> 0 then
373
          begin
374
            //ShowWindow(GetDlgItem(DlgWin, ID_EDGE_BOTTOM), SW_HIDE);
375
            Inc(LIntSmaller, 5);
376
          end;
377
          Inc(LIntSmaller, 10);
378
        end;
379
 
380
        if LIntSmaller <> 0 then
381
        begin
382
          ResizeControl(DlgWin, False, -LIntSmaller);
383
          for i := Low(POS_CTRLS_HIDE) to High(POS_CTRLS_HIDE) do
384
            ResizeControl(GetDlgItem(DlgWin, POS_CTRLS_HIDE[i]), True, -LIntSmaller);
385
        end;
386
 
387
        Windows.SetWindowText(DlgWin, PChar(VStr_SFX_Caption));
388
//        SendDlgItemMessage(DlgWin, ID_LV_FILES, WM_SETFONT, 0, 0);
389
 
390
        (* Fill the list view and select all items *)
391
        FillListView(DlgWin);
392
        if (so_InitiallyHideFiles and Options) = 0 then
393
          // show files listview
394
          SendMessage(DlgWin, WM_COMMAND, ID_BTN_SHOWFILES, 0)
395
        else
396
        if (so_ForceHideFiles and Options) <> 0 then
397
          // no "show files" button
398
          DestroyWindow(GetDlgItem(DlgWin, ID_BTN_SHOWFILES));
399
 
400
        if (so_AutoRun and Options) <> 0 then
401
//        if soAutoRun in Options then
402
          // do the extraction automatically, if autorun = true
403
          SetTimer(DlgWin, 0, 20, nil);
404
        //PostMessage(DlgWin, WM_COMMAND, ID_BTN_YES, 0);
405
      end;
406
 
407
      WM_TIMER:
408
      begin
409
        KillTimer(DlgWin, 0);
410
        PostMessage(DlgWin, WM_COMMAND, ID_BTN_YES, 0);
411
      end;
412
 
413
      (* Handle button presses, etc. *)
414
      WM_NOTIFY:
415
        case DlgWParam of
416
          ID_LV_FILES:
417
          begin
418
            case PNMHDR(DlgLParam)^.code of
419
              LVN_ITEMCHANGED:
420
              begin
421
                if ((so_AskFiles and Options) <> 0) and (not bInExtraction) then
422
                  EnableWindow(GetDlgItem(DlgWin, ID_BTN_YES),
423
                    (SendDlgItemMessage(DlgWin, ID_LV_FILES,
424
                    LVM_GETSELECTEDCOUNT, 0, 0) > 0));
425
              end;
426
            end;
427
          end;
428
        end;
429
      WM_COMMAND:
430
        case LOWORD(DlgWParam) of
431
          ID_ST_FILES:
432
            // 09/18/2002 -> select the files list by pressing the "Files" shortcut key
433
            SetFocus(GetDlgItem(DlgWin, ID_LV_FILES));
434
          ID_BTN_SHOWFILES:
435
          begin
436
            // show files
437
            for i := Low(SHOW_CTRLS) to High(SHOW_CTRLS) do
438
              ShowWindow(GetDlgItem(DlgWin, SHOW_CTRLS[i]), SW_SHOW);
439
            ResizeControl(DlgWin, False, 66);
440
            for i := Low(POS_CTRLS) to High(POS_CTRLS) do
441
              ResizeControl(GetDlgItem(DlgWin, POS_CTRLS[i]), True, 66);
442
            SetFocus(GetDlgItem(DlgWin, ID_LV_FILES));
443
            DestroyWindow(GetDlgItem(DlgWin, ID_BTN_SHOWFILES));
444
          end;
445
 
446
          //## added the ability to select a extract directory
447
          // Modified by Deepu Chandy Thomas //
448
          ID_BTN_BROWSE:
449
          begin
450
            FillChar(VStr_ExtractPath, sizeof(VStr_ExtractPath), 0);
451
            VStr_ExtractPath := StrGetEditText(DlgWin);
452
            if BrowseDirectory(DlgWin, VStr_ExtractPath) then
453
              SetDlgItemText(DlgWin, ID_EDITBOX, PChar(VStr_ExtractPath));
454
          end;
455
 
456
          // show the copyright information
457
          ID_BTN_ABOUT:
458
          begin
459
            tmp := SFXString(-SFX_Cap_App) + ' version ' + SFX_Version;
460
{$IFDEF UNICODE}
461
            i := SFX_MSG_ABOUT0;
462
{$ELSE}
463
            i := SFX_MSG_ABOUT1;
464
{$ENDIF}
465
            while i <= SFX_MSG_TRANSLATION do
466
            begin
467
              tmp := tmp + SFXString(i);
468
              inc(i);
469
            end;
470
            MsgBox(DlgWin, tmp, SFXString(SFX_Cap_About), MB_OK);
471
          end;
472
 
473
          ID_RB_OVERWRITE:
474
            VRec_SFXHeader.DefOVW := WORD(som_Overwrite);
475
 
476
          ID_RB_SKIP:
477
            VRec_SFXHeader.DefOVW := WORD(som_Skip);
478
 
479
          ID_RB_CONFIRM:
480
            VRec_SFXHeader.DefOVW := WORD(som_Ask);
481
 
482
          ID_BTN_YES:
483
          begin
484
            //## if the user is not allowed to (de)select files from the archive, then
485
            //   select them all
486
            VBool_Cancelled := False;
487
            if (so_AskFiles and Options) = 0 then
488
              SelectAllInFilesListView(DlgWin);
489
 
490
            VStr_ExtractPath := RemoveDirSeparator(StrGetEditText(DlgWin));
491
 
492
            if VStr_ExtractPath = '' then
493
            begin
494
              VStr_ExtractPath := GetCurDir;
495
              SetDlgItemText(DlgWin, ID_EDITBOX, PChar(VStr_ExtractPath));
496
              Exit;
497
            end;
498
 
499
            EnableChildren(DlgWin, False);
500
            // re-enable close-button
501
            if (so_CanBeCancelled and Options) <> 0 then
502
              EnableWindow(GetDlgItem(DlgWin, ID_BTN_NO), True);
503
 
504
            // show progress bar
505
            for i := Low(SWAP_CTRLS) to High(SWAP_CTRLS) do
506
              ShowWindow(GetDlgItem(DlgWin, SWAP_CTRLS[i]),
507
                SHOW_CMD[i <> Low(SWAP_CTRLS)]);
508
 
509
            // do extraction
510
            bInExtraction := True;
511
            bOK := Extract(DlgWin);
512
            bInExtraction := False;
513
 
514
            // hide progress bar
515
            for i := Low(SWAP_CTRLS) to High(SWAP_CTRLS) do
516
              ShowWindow(GetDlgItem(DlgWin, SWAP_CTRLS[i]),
517
                SHOW_CMD[i = Low(SWAP_CTRLS)]);
518
 
519
            // enable controls
520
            EnableChildren(DlgWin, True);
521
 
522
            if not bOK then
523
            begin
524
              if (so_HideOverwriteBox and Options) <> 0 then
525
                DefOVW := som_Ask;
526
 
527
              if not VBool_Cancelled then
528
              begin
529
                if IsWindow(GetDlgItem(DlgWin, ID_BTN_SHOWFILES)) then
530
                  // show files if something went wrong
531
                  SendMessage(DlgWin, WM_COMMAND, ID_BTN_SHOWFILES, 0);
532
                if (so_ForceHideFiles and Options) <> 0 then
533
                  ErrorMsgBoxFmt1(DlgWin, SFX_Msg_SomeNotExtracted, '')
534
                else
535
                  ErrorMsgBoxFmt1(DlgWin, SFX_Msg_SelNotExtracted, '');
536
              end;
537
            end
538
            else
539
            begin
540
              if ((Options and (so_SuccessAlways)) <> 0) or
541
                  ((Options and (so_AutoRun or so_NoSuccessMsg)) = 0) then
542
                MsgBox(DlgWin, SFXString(SFX_Msg_AllExtracted),
543
                    SFXString(SFX_Cap_Finished), MB_OK);
544
              if ((so_AskCmdLine and Options) = 0) or
545
                (SendMessage(GetDlgItem(DlgWin, ID_CB_RUN), BM_GETCHECK, 0, 0) = 1) then
546
                if (VStr_SFX_CmdLine <> '') and (ExecuteCMD < 32) then
547
                  ErrorMsgBox(DlgWin, GetRunErrorMessage);
548
              EndDialog(DlgWin, idOk);
549
            end;
550
 
551
            if (so_AutoRun and Options) <> 0 then
552
              PostMessage(DlgWin, WM_COMMAND, ID_BTN_NO, 0);
553
          end;
554
 
555
          ID_BTN_NO:
556
          begin
557
            if not bInExtraction then
558
            begin
559
              VStr_ExtractPath := StrGetEditText(DlgWin);
560
              if DirectoryExists(VStr_ExtractPath) then
561
                ChDir(VStr_ExtractPath);
562
              EndDialog(DlgWin, LOWORD(DlgWParam));
563
              Exit;
564
            end
565
            else
566
            begin
567
              if ((so_CanBeCancelled and Options) <> 0) and
568
                (VBool_Cancelled or (MsgBox(DlgWin,
569
                    SFXString(SFX_Msg_QueryCancel),
570
                VStr_SFX_Caption, MB_YESNO or MB_ICONWARNING) = idYes)) then
571
              begin
572
                VBool_Cancelled := True;
573
                PostMessage(DlgWin, WM_CLOSE, DlgWParam, DlgLParam);
574
                bInExtraction := False;
575
              end;
576
            end;
577
          end;
578
        end;
579
    end;
580
  Result := False;
581
end;
582
 
583
end.