uses Windows, Clipbrd, ShellAPI ....;

var
  DropHandle, DropEffect, Effect : HDROP;
  FileCount:Integer;
  Counter:Integer;
  FileName:array [0..MAX_PATH] of char;
const
  DROPEFFECT_NONE   = 0;
  DROPEFFECT_COPY   = 1;
  DROPEFFECT_MOVE   = 2;
  DROPEFFECT_LINK   = 4;
  DROPEFFECT_SCROLL = $80000000;
begin
  OpenClipboard(0);
  DropEffect := RegisterClipboardFormat('Preferred DropEffect');
  DropHandle := GetClipboardData(CF_HDROP);
  if DropHandle>0 then
  begin
    Effect := GetClipboardData(DropEffect);
    if Effect=0 then Effect := DROPEFFECT_COPY
    else Effect := PDWORD(Effect)^;
    case Effect of
      DROPEFFECT_COPY + DROPEFFECT_LINK:ShowMessage('Copy');
      DROPEFFECT_MOVE:ShowMessage('Move');
    end;
    FileCount:=DragQueryFile(DropHandle,Cardinal(-1),nil,0);
    for Counter := 0 to FileCount-1 do
    begin
      DragQueryFile(DropHandle, Counter, FileName, sizeof(FileName));
      ShowMessage(FileName);
    end;
  end;
  CloseClipboard;
end;

相关文章:

  • 2021-12-22
  • 2021-08-09
  • 2022-12-23
  • 2023-03-20
  • 2021-11-23
  • 2022-12-23
  • 2021-12-18
猜你喜欢
  • 2021-07-22
  • 2022-12-23
  • 2021-08-18
  • 2021-11-20
  • 2021-05-16
  • 2022-12-23
相关资源
相似解决方案