87 lines
2.6 KiB
ObjectPascal
87 lines
2.6 KiB
ObjectPascal
unit cde_LinkCreatorForm;
|
|
{$mode delphi}
|
|
{$codepage UTF8}
|
|
interface
|
|
uses Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, ComCtrls, StdCtrls, ExtCtrls,
|
|
ANBInputBox;
|
|
type
|
|
{ Tcde_LinkCreatorFrm }
|
|
Tcde_LinkCreatorFrm = class(TForm)
|
|
AddDriveBtn: TButton;
|
|
CreateLinkBtn: TButton;
|
|
CancelBtn: TButton;
|
|
DrivesBoxLbl: TLabel;
|
|
Sep1: TBevel;
|
|
RemoveDriveBtn: TButton;
|
|
DrivesBox: TListBox;
|
|
ButtonsPanel: TPanel;
|
|
procedure AddDriveBtnClick(Sender: TObject);
|
|
procedure CreateLinkBtnClick(Sender: TObject);
|
|
procedure RemoveDriveBtnClick(Sender: TObject);
|
|
private
|
|
public
|
|
end;
|
|
var
|
|
cde_LinkCreatorFrm: Tcde_LinkCreatorFrm;
|
|
implementation
|
|
uses cde_DriveAdderForm, kernel;
|
|
{ Tcde_LinkCreatorFrm }
|
|
procedure Tcde_LinkCreatorFrm.AddDriveBtnClick(Sender: TObject);
|
|
begin
|
|
cde_DriveAdderFrm.ShowModal;
|
|
end;
|
|
procedure Tcde_LinkCreatorFrm.CreateLinkBtnClick(Sender: TObject);
|
|
var Drives, Params: String;
|
|
LinkName: AnsiString;
|
|
b: Boolean;
|
|
i: Integer;
|
|
begin
|
|
if DrivesBox.Items.Count = 0 then
|
|
begin
|
|
//ShowMessageBox(GetLocalStrA(21), MB_ICONERROR, MB_OK);
|
|
Abort;
|
|
end;
|
|
Drives:= '';
|
|
Params:= '/dcount=' + IntToStr(DrivesBox.Items.Count) + ' ';
|
|
if DrivesBox.Items.Count > 1 then
|
|
begin
|
|
for i:= 0 to DrivesBox.Items.Count - 2 do
|
|
begin
|
|
Drives:= Drives + DrivesBox.Items.Strings[i] + ', ';
|
|
Params:= Params + '/d_' + IntToStr(i+1) + '=' + DrivesBox.Items.Strings[i][1] + ' ';
|
|
end;
|
|
Drives:= Drives + DrivesBox.Items.Strings[DrivesBox.Items.Count - 1];
|
|
Params:= Params + '/d_' + IntToStr(DrivesBox.Items.Count) + '=' + DrivesBox.Items.Strings[DrivesBox.Items.Count - 1][1];
|
|
end
|
|
else
|
|
begin
|
|
Drives:= Drives + DrivesBox.Items.Strings[0];
|
|
Params:= Params + '/d_1=' + DrivesBox.Items.Strings[0][1];
|
|
end;
|
|
b:= False;
|
|
//try
|
|
//LinkName:= UTF8ToSys(ShowInputBox(GetLocalStrA(16), GetLocalStrA(17), Format(GetLocalStrA(13), [Drives]), b));
|
|
//if b then
|
|
//begin
|
|
//CreateShortCut(GetDesktopDir + LinkName + '.lnk', Params, GetCDEPath + 'cdejecter.exe');
|
|
//if FileExists(GetDesktopDir + LinkName + '.lnk')then
|
|
//ShowMessageBox(GetLocalStrA(14), MB_ICONASTERISK)
|
|
//else
|
|
//ShowMessageBox(GetLocalStrA(15), MB_ICONERROR);
|
|
//end
|
|
//else
|
|
//ShowMessageBox(GetLocalStrA(18), MB_ICONERROR);
|
|
//except
|
|
//ShowMessageBox(GetLocalStrA(15), MB_ICONERROR);
|
|
//end;
|
|
end;
|
|
procedure Tcde_LinkCreatorFrm.RemoveDriveBtnClick(Sender: TObject);
|
|
begin
|
|
if DrivesBox.ItemIndex > -1 then
|
|
//if ShowMessageBox(Format(GetLocalStrA(20), [DrivesBox.Items.Strings[DrivesBox.ItemIndex]]), MB_ICONWARNING, MB_YESNO) = IDYES then
|
|
//DrivesBox.Items.Delete(DrivesBox.ItemIndex);
|
|
end;
|
|
initialization
|
|
{$R *.lfm}
|
|
end.
|