掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
ファイルをクリップボードにコピーするには? (ID:14613)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
こちらをどうぞ。 貼り付けのほうは 自分で http://sapporo.cool.ne.jp/tanomi/qanda/a056.html を 解読してください http://sapporo.cool.ne.jp/tanomi/qanda/a055.html は ↓みたいな感じです。 procedure TForm1.Button2Click(Sender: TObject); var MyHandle : THandle; hDrop : Pointer; nFiles , i : Integer; Buf : array[0..MAX_PATH+500] of Char; FileListsText : String; dwEffect : Word; CF_DROPEFFECT : UINT; begin if Clipboard.HasFormat(CF_HDROP) then begin MyHandle := Clipboard.GetAsHandle(CF_HDROP); if MyHandle <>0 then hDrop := Windows.GlobalLock(MyHandle); if hDrop<>nil then try nFiles := DragQueryFile(Integer(hDrop) , $FFFFFFFF, nil, 0); for i := 0 to nFiles-1 do begin DragQueryFile(Integer(hDrop) , i, Buf, SizeOf(Buf)-1); if (i=0) then FileListsText := Buf else FileListsText := FileListsText + #13#10+ Buf; end; finally if MyHandle <>0 then GlobalUnlock(MyHandle); end; end; CF_DROPEFFECT := RegisterClipboardFormat(CFSTR_PREFERREDDROPEFFECT); if Clipboard.HasFormat(CF_DROPEFFECT) then begin MyHandle := Clipboard.GetAsHandle(CF_DROPEFFECT); if MyHandle <>0 then begin hDrop := Windows.GlobalLock(MyHandle); try dwEffect := PWord(hDrop)^; finally if MyHandle <>0 then GlobalUnlock(MyHandle); end; end; end; if (dwEffect and DROPEFFECT_COPY)>0 then begin //コピー Memo1.Lines.Add('コピー'); end; if (dwEffect and DROPEFFECT_MOVE)>0 then begin //切り取り Memo1.Lines.Add('切り取り'); end; if (dwEffect and DROPEFFECT_LINK)>0 then begin //ショートカット Memo1.Lines.Add('ショートカット'); end; Memo1.Lines.Add(FileListsText); end;
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.