⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ajfileeditparams.pas

📁 FileBrowser, source code for delphi
💻 PAS
📖 第 1 页 / 共 2 页
字号:
          ///////////////////////////////////////////////////////////////////////
          //                                                                   //
          //       SoftSpot Software Component Library                         //
          //       Key Maker software component                                //
          //                                                                   //
          //       Copyright (c) 1996 - 2002 SoftSpot Software Ltd.            //
          //       ALL RIGHTS RESERVED                                         //
          //                                                                   //
          //   The entire contents of this file is protected by U.S. and       //
          //   International Copyright Laws. Unauthorized reproduction,        //
          //   reverse-engineering, and distribution of all or any portion of  //
          //   the code contained in this file is strictly prohibited and may  //
          //   result in severe civil and criminal penalties and will be       //
          //   prosecuted to the maximum extent possible under the law.        //
          //                                                                   //
          //   RESTRICTIONS                                                    //
          //                                                                   //
          //   THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED      //
          //   FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE        //
          //   COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE       //
          //   AVAILABLE TO OTHER INDIVIDUALS WITHOUT EXPRESS WRITTEN CONSENT  //
          //   AND PERMISSION FROM SOFTSPOT SOFTWARE LTD.                      //
          //                                                                   //
          //   CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON       //
          //   ADDITIONAL RESTRICTIONS.                                        //
          //                                                                   //
          ///////////////////////////////////////////////////////////////////////

unit ajFileEditParams;

{                       -=< Key Maker File Browser File Params Editor >=-
{
{ Copyright SoftSpot Software 2002 - All Rights Reserved
{
{ Author        : Andrew J Jameson
{
{ Web site      : www.softspotsoftware.com
{ e-mail        : contact@softspotsoftware.com
{
{ Creation Date : 01 March 2002
{
{ Version       : 1.00
{
{ Description   : File params editor for Key Maker.                                                }

interface

uses
  Windows, Forms, StdCtrls, ComCtrls, Controls, ExtCtrls, Classes, SysUtils, ajTimeEdit, ajWheel,
  Buttons;

function FileTimeToDateTimeStr(FileTime : TFileTime) : string;

type
  TfrmEditFileParams  = class(TForm)
    Bevel1        : TBevel;
    btnCancel     : TSpeedButton;
    btnClearTime  : TSpeedButton;
    btnNow        : TSpeedButton;
    btnUpdate     : TSpeedButton;
    cbArchive     : TCheckBox;
    cbHidden      : TCheckBox;
    cbModify      : TCheckBox;
    cbReadOnly    : TCheckBox;
    cbSynchronize : TCheckBox;
    cbSystem      : TCheckBox;
    pnAttributes  : TPanel;
    pnBack        : TPanel;
    pnToolbar     : TPanel;
    procedure FormCreate          (Sender : TObject);
    procedure FormShow            (Sender : TObject);
    procedure FormDestroy         (Sender : TObject);
    procedure dtDateChange        (Sender : TObject);
    procedure cbSynchronizeClick  (Sender : TObject);
    procedure btnNowClick         (Sender : TObject);
    procedure btnClearTimeClick   (Sender : TObject);
    procedure btnUpdateClick      (Sender : TObject);
    procedure btnCancelClick      (Sender : TObject);
    procedure cbModifyClick       (Sender : TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
    fajWheelSupport : TajAddWheelSupport;
    fCheckBox       : array[0..2] of TCheckBox;
    fDateEdit       : array[0..2] of TDateTimePicker;
    fTimeEdit       : array[0..2] of TajTimeEdit;
    fWin32FindData  : TWin32FindData;
    fFileHandle     : THandle;
    procedure SetfFileHandle    (Value : THandle);
  protected
    function  GetSaveAttributes : boolean;
    function  GetDate           (Index : integer) : TDateTime;
    procedure SetDate           (Index : integer; Value : TDateTime);
    procedure SetAllDates       (Value : TDateTime);
    procedure CheckBoxClick     (Sender : TObject);
  public
    { Public declarations }
    property  Win32FindData   : TWin32FindData    read fWin32FindData     write fWin32FindData;
	  property  FileHandle      : THandle           read fFileHandle        write SetfFileHandle;
    property  SaveAttributes  : boolean           read GetSaveAttributes;
  end;

implementation

{$R *.DFM}

{--------------------------------------------------------------------------------------------------}
{                             Miscellaneous FileTime Functions                                     }
{--------------------------------------------------------------------------------------------------}

function FileTimeToDateTime(FileTime : TFileTime) : TDateTime;
// Convert FileTime to TDateTime.
var
  SystemTime  : TSystemTime;
begin
  FileTimeToLocalFileTime(FileTime, FileTime);
  FileTimeToSystemTime(FileTime, SystemTime);
  Result  := SystemTimeToDateTime(SystemTime);
end; {FileTimeToDateTime}

{--------------------------------------------------------------------------------------------------}

function DateTimeToFileTime(DateTime : TDateTime) : TFileTime;
// Convert DateTime to TFileTime.
var
  SystemTime  : TSystemTime;
begin
  if (DateTime > 0) then begin
    DateTimeToSystemTime(DateTime, SystemTime);
    SystemTimeToFileTime(SystemTime, Result);
    LocalFileTimeToFileTime(Result, Result);
  end else begin
    Result.dwLowDateTime  := 0;
    Result.dwHighDateTime := 0;
  end; {if}
end; {DateTimeToFileTime}

{--------------------------------------------------------------------------------------------------}

function FileTimeToDateTimeStr(FileTime : TFileTime) : string;
// Convert FileTime to a DateTime string.
begin
  Result    := FormatDateTime(ShortDateFormat + ' hh:mm:ss:zzz', FileTimeToDateTime(FileTime));
end; {FileTimeToDateTimeStr}

{--------------------------------------------------------------------------------------------------}
{                                   TfrmEditFileParams                                             }
{--------------------------------------------------------------------------------------------------}

procedure TfrmEditFileParams.FormCreate(Sender : TObject);
var
  lp1       : integer;
  CursorPos : TPoint;
begin
  GetCursorPos(CursorPos);
  Left  := CursorPos.x;
  Top   := CursorPos.y;
  if (Left + Width > Screen.Width) then
    Left := Screen.Width - Width;
  if (Top + Height > Screen.Height) then
    Top := Screen.Height - Height;

  for lp1 := 0 to 2 do begin

    fCheckBox[lp1]  := TCheckBox.Create(Self);
    with fCheckBox[lp1] do begin
      Parent    := pnBack;
      SetBounds(4, 13 + lp1 * 24, 65, 17);
      Alignment := taLeftJustify;
      Tag       := lp1;
      Checked   := true;
      case lp1 of
        0 : Caption := 'Created';
        1 : Caption := 'Modified';
        2 : Caption := 'Accessed';
      end; {case}
      OnClick := CheckBoxClick;
    end; {with}

    fDateEdit[lp1]  := TDateTimePicker.Create(Self);
    with fDateEdit[lp1] do begin
      Parent          := pnBack;
      SetBounds(71, 11 + lp1 * 24, 85, 21);
      DoubleBuffered  := true;
      DateMode        := dmUpDown;
      Tag             := lp1;
      OnChange        := dtDateChange;
    end; {with}

    fTimeEdit[lp1]  := TajTimeEdit.Create(Self);
    with fTimeEdit[lp1] do begin
      Parent          := pnBack;
      SetBounds(159, 11 + lp1 * 24, 90, 21);
      DoubleBuffered  := true;
      Tag             := lp1;
      OnTimeChange    := dtDateChange;
    end; {with}

  end; {for}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -