home *** CD-ROM | disk | FTP | other *** search
- unit Lbldlg;
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs;
-
- type
- TLabelDialog = class(TCommonDialog)
- private
- { Private declarations }
- FVolume : TCaption;
-
- protected
- { Protected declarations }
- public
- { Public declarations }
- published
- { Published declarations }
- property Volume : TCaption read FVolume write FVolume;
-
- constructor Create( AOwner : TComponent ); override;
-
- function ReadVolume( drive : string ) : string;
- function WriteVolume( vol : string ) : integer;
- function DeleteVolume( drive : string ): integer;
-
-
- end;
-
- procedure Register;
-
- implementation
-
- Uses Dosutil;
-
- procedure Register;
- begin
- RegisterComponents('Custom Controls', [TLabelDialog]);
- end;
-
- constructor TLabelDialog.Create( AOwner : TComponent );
- begin
- inherited Create( AOwner );
- FVolume := Volume;
- end;
-
- function TLabelDialog.ReadVolume( drive : string ) : string;
- begin
- try
- ReadVolume := GetLabel( drive );
- except
- on EInOutError do MessageDlg( drive + 'Not Found',
- mtError, [mbOk], 0 );
- end;
- end;
-
- function TLabelDialog.WriteVolume( vol : string ) : integer;
- begin
- try
- WriteVolume := SetLabel( vol );
- except
- on EInOutError do MessageDlg( 'Error Writing Label',
- mtError, [mbOk], 0 );
- end;
- end;
-
- function TLabelDialog.DeleteVolume( drive : string ): integer;
- begin
- try
- DeleteVolume := ClearLabel( drive );
- except
- on EInOutError do MessageDlg( 'Error Deleting Volume in drive ' +
- drive, mtError, [mbOk], 0);
- end;
- end;
-
- end.
-