home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 August / VPR9708A.ISO / D3TRIAL / INSTALL / DATA.Z / COPYHK.PAS < prev    next >
Pascal/Delphi Source File  |  1997-05-12  |  1KB  |  38 lines

  1. unit CopyHk;
  2.  
  3. interface
  4.  
  5. uses
  6.     Windows, ComObj, ComServ, SysUtils, ShlObj;
  7.  
  8. Const
  9.   CLSID_CopyHookShellExtension: TGUID = (
  10.     D1:$8e3e0f0a; D2:$0fcc; D3:$11ce; D4:($bc, $b0, $b3, $fd, $0e, $25, $38, $19));
  11.  
  12.  
  13. type
  14.   TCopyHook = class(TComObject, ICopyHookA)
  15.   public
  16.     function CopyCallback(Wnd: HWND; wFunc, wFlags: UINT; pszSrcFile: PAnsiChar;
  17.       dwSrcAttribs: DWORD; pszDestFile: PAnsiChar; dwDestAttribs: DWORD): UINT; stdcall;
  18.   end;
  19.  
  20. implementation
  21.  
  22. function TCopyHook.CopyCallBack(Wnd: HWND; wFunc, wFlags: UINT; pszSrcFile: PAnsiChar;
  23.   dwSrcAttribs: DWORD; pszDestFile: PAnsiChar; dwDestAttribs: DWORD): UINT;
  24. // This is the method which is called by the shell for folder operations
  25. const
  26.   MyMessage: String = 'Are you sure you want to commit this operation?';
  27. begin
  28.   // confirm operation
  29.   Result := MessageBox(Wnd,  PChar(Format(MyMessage, [pszSrcFile])),
  30.     'Delphi 3.0 CopyHook Shell Extension ...' , MB_YESNO);
  31. end;
  32.  
  33. initialization
  34.   TComObjectFactory.Create(ComServer, TCopyHook, CLSID_CopyHookShellExtension,
  35.     '', 'This is a CopyHook Sample for 3.0', ciMultiInstance);
  36.  
  37. end.
  38.