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

📄 pasch.pas

📁 外国人写的各种类型的源代码,有兴趣的朋友看看吧!是学习的好东西哟
💻 PAS
字号:
unit PasCH;

interface

uses
  Windows, ComObj, ComServ, ShlObj, ShellAPI,
  SysUtils;

const
  CLSID_PascalCopyHook: TGUID =
    '{80A06FA0-7DF2-11D0-98D0-444553540000}';

type
  TPasCopyHook = class(TComObject, ICopyHook)
  public
    function CopyCallback (Hwnd: THandle;
      wFunc, wFlags: UINT; pszSrcFile: PAnsiChar;
      dwSrcAttribs: DWORD; pszDestFile: PAnsiChar;
      dwDestAttribs: DWORD): UINT; stdcall;
  end;

implementation

function TPasCopyHook.CopyCallback (Hwnd: THandle;
  wFunc, wFlags: UINT; pszSrcFile: PAnsiChar;
  dwSrcAttribs: DWORD; pszDestFile: PAnsiChar;
  dwDestAttribs: DWORD): UINT; stdcall;
var
  Msg: string;
begin
//  Application.Handle := Hwnd;
//  MessType := mtConfirmation;
  case wFunc of
   FO_COPY: Msg := Format (
     'Are you sure you want to copy the %s folder to the %s destination',
     [pszSrcFile, pszDestFile]);
   FO_DELETE:
   begin
     Msg := Format ('Caution... the folder %s is about to be deleted, unless you say no',
       [pszSrcFile]);
//     MessType := mtWarning;
   end;
   FO_MOVE: Msg := Format (
     'Are you sure you want to move the %s folder to the %s destination',
     [pszSrcFile, pszDestFile]);
   FO_RENAME: Msg := Format (
     'Are you sure you want to rename the %s folder as %s',
     [pszSrcFile, pszDestFile]);
   else
     Msg := '';
  end;
  if Msg <> '' then // ask for confirmation
    Result := MessageBox (Hwnd, PChar(Msg),
      'PasCHook Demo', mb_YesNoCancel)
  else
    Result := idYes;
end;

initialization
  TComObjectFactory.Create(ComServer, TPasCopyHook,
    CLSID_PascalCopyHook, '',
    'CopyHook Demo from Mastering Delphi 3',
    ciMultiInstance);
end.

⌨️ 快捷键说明

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