線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1729
推到 Plurk!
推到 Facebook!

在Windows的檔案總管中,如何完成檔案操作的呢?

答題得分者是:hagar
qoo1234
版主


發表:256
回覆:1167
積分:659
註冊:2003-02-24

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-10-07 21:16:25 IP:218.163.xxx.xxx 未訂閱
在Windows的檔案總管中,選中一個或多個檔案,在檔案上單擊滑鼠右鍵,在彈出選單中選複製。    再切換到另外的目錄,單擊滑鼠右鍵,按貼上。就這樣執行了一次檔案的拷貝操作,那麼Windows在拷貝檔案中,執行了什麼操作,是否將整個檔案拷貝到剪貼板上了呢?    網海無涯,學無止境!
hagar
版主


發表:143
回覆:4056
積分:4445
註冊:2002-04-14

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-10-11 15:45:49 IP:202.39.xxx.xxx 未訂閱
報告 10 星上將, 參考以下兩篇, 也許有您要的: 1.Drag and drop from explorer http://www.howtodothings.com/showarticle.asp?article=17
unit Unit1;    interface    uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;    type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    { Private declarations }
  protected
    procedure WMDropFiles(var Msg: TWMDropFiles); message WM_DROPFILES;
  public
    { Public declarations }
  end;    var
  Form1: TForm1;    implementation    {$R *.DFM}    uses ShellAPI;    procedure TForm1.FormCreate(Sender: TObject);
begin
  { This call to DragAcceptFiles tells Windows that we want to know when files
    are dropped on our form from Explorer or File Manager. }
  DragAcceptFiles(Handle, TRUE);
end;    procedure TForm1.FormDestroy(Sender: TObject);
begin
  { Notify Windows that we no longer want drop notification messages. }
  DragAcceptFiles(Handle, FALSE);
end;    procedure TForm1.WMDropFiles(var Msg: TWMDropFiles);
var
  I: integer;
  S: string;
begin
  with Msg do
  begin
    { Calling DragQueryFile with the file number as -1 ($FFFFFFFF) will return
      the number of files which were dropped on the form. }
    for I := 0 to DragQueryFile(Drop, -1, nil, 0) - 1 do
    begin
      { Here we call DragQueryFile for each file dropped specifying a buffer
        length of zero the determine the number of characters needed for the
        filename, and then use SetLength to allocate the proper amount of space.
        Note that we must add one to the value returned by DragQueryFile to
        leave room for the null-terminator. }
      SetLength(S, DragQueryFile(Drop, I, nil, 0) 1);
      { Get the complete filename in S. Any processing which needs to be done
        for each file can be done after this call. }
      DragQueryFile(Drop, I, PChar(S), Length(S));
    end;
    { DragFinish completes the operation and frees the associated resources. }
    DragFinish(Drop);
  end;
end;    end.
2.How to paste files from Windows Explorer into your application http://www.lmc-mediaagentur.de/dpool/tips/0657.htm
uses
  clipbrd, shellapi;    {$R *.DFM}    procedure TForm1.Button1Click(Sender: TObject);
var
  f: THandle;
  buffer: Array [0..MAX_PATH] of Char;
  i, numFiles: Integer;
begin
  Clipboard.Open;
  try
    f := Clipboard.GetAsHandle( CF_HDROP );
    if f <> 0 then
    begin
      numFiles := DragQueryFile( f, $FFFFFFFF, nil, 0 );
      memo1.Clear;
      for i:= 0 to numfiles - 1 do
      begin
        buffer[0] := #0;
        DragQueryFile( f, i, buffer, sizeof(buffer));
        memo1.lines.add( buffer );
      end;
    end;
  finally
    Clipboard.close;
  end;
end;
--- 歡迎光臨 KTop 研究院
qoo1234
版主


發表:256
回覆:1167
積分:659
註冊:2003-02-24

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-10-11 19:46:58 IP:218.163.xxx.xxx 未訂閱
報告KTop 研究院 hagar 院長,謝謝你的指教~ < src="http://delphi.ktop.com.tw/download/upload\33223_qoo.gif">網海無涯,學無止境!
系統時間:2024-04-29 15:17:54
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!