Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to paste files from Windows Explorer into your application Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
20-Oct-02
Category
Files Operation
Language
Delphi 2.x
Views
47
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Jonas Bilinkevicius

I would like to be able to go to Windows Explorer, select a series of files, and 
then allow the user to "Paste" these files into my application. I simply need a 
list of the file names that were copied to the clipboard. Anyone know how to access 
this list?

Answer:

You can use OLE Drag & Drop, but since Explorer creates a standard CF_HDROP 
clipboard block you can also hack it this way:

1   uses
2     clipbrd, shellapi;
3   
4   {$R *.DFM}
5   
6   procedure TForm1.Button1Click(Sender: TObject);
7   var
8     f: THandle;
9     buffer: array[0..MAX_PATH] of Char;
10    i, numFiles: Integer;
11  begin
12    Clipboard.Open;
13    try
14      f := Clipboard.GetAsHandle(CF_HDROP);
15      if f <> 0 then
16      begin
17        numFiles := DragQueryFile(f, $FFFFFFFF, nil, 0);
18        memo1.Clear;
19        for i := 0 to numfiles - 1 do
20        begin
21          buffer[0] := #0;
22          DragQueryFile(f, i, buffer, sizeof(buffer));
23          memo1.lines.add(buffer);
24        end;
25      end;
26    finally
27      Clipboard.close;
28    end;
29  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC