home *** CD-ROM | disk | FTP | other *** search
/ CD Shareware Magazine 1996 December / CD_shareware_12-96.iso / WIN / Programa / LABELER.ZIP / LBLDLG.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1995-12-28  |  1.7 KB  |  80 lines

  1. unit Lbldlg;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs;
  8.  
  9. type
  10.   TLabelDialog = class(TCommonDialog)
  11.   private
  12.     { Private declarations }
  13.     FVolume : TCaption;
  14.  
  15.   protected
  16.     { Protected declarations }
  17.   public
  18.     { Public declarations }
  19.   published
  20.     { Published declarations }
  21.     property Volume : TCaption read FVolume write FVolume;
  22.  
  23.     constructor Create( AOwner : TComponent ); override;
  24.  
  25.     function ReadVolume( drive : string ) : string;
  26.     function WriteVolume( vol : string ) : integer;
  27.     function DeleteVolume( drive : string ): integer;
  28.  
  29.  
  30.   end;
  31.  
  32. procedure Register;
  33.  
  34. implementation
  35.  
  36. Uses Dosutil;
  37.  
  38. procedure Register;
  39. begin
  40.   RegisterComponents('Custom Controls', [TLabelDialog]);
  41. end;
  42.  
  43. constructor TLabelDialog.Create( AOwner : TComponent );
  44. begin
  45.      inherited Create( AOwner );
  46.      FVolume := Volume;
  47. end;
  48.  
  49. function TLabelDialog.ReadVolume( drive : string ) : string;
  50. begin
  51.      try
  52.         ReadVolume := GetLabel( drive );
  53.      except
  54.            on EInOutError do MessageDlg( drive + 'Not Found',
  55.                           mtError, [mbOk], 0 );
  56.      end;
  57. end;
  58.  
  59. function TLabelDialog.WriteVolume( vol : string ) : integer;
  60. begin
  61.      try
  62.         WriteVolume := SetLabel( vol );
  63.      except
  64.            on EInOutError do MessageDlg( 'Error Writing Label',
  65.                           mtError, [mbOk], 0 );
  66.      end;
  67. end;
  68.  
  69. function TLabelDialog.DeleteVolume( drive : string ): integer;
  70. begin
  71.      try
  72.         DeleteVolume := ClearLabel( drive );
  73.      except
  74.            on EInOutError do MessageDlg( 'Error Deleting Volume in drive ' +
  75.                           drive, mtError, [mbOk], 0);
  76.      end;
  77. end;
  78.  
  79. end.
  80.