请问怎样实现把一个文件或文件夹拖曳到你自己程序的Listview中? 推荐DragDrop控件,挺好使的在Delphi仓库中下载 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 其实这个组件Delphi6中就自带了如果用程序实现的话,要用一个Com接口,比较麻烦 unit Unit1;interfaceuses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,Dialogs, StdCtrls;typeTForm1 = class(TForm) Memo1: TMemo; procedure FormCreate(Sender: TObject);private procedure WMDROPFILES(var Message: TWMDROPFILES); message WM_DROPFILES; { Private declarations }public { Public declarations }end;varForm1: TForm1;implementation{$R *.DFM}uses ShellApi;procedure TForm1.FormCreate(Sender: TObject);begin{Let Windows know we accept dropped files} DragAcceptFiles(Form1.Handle, True);end;procedure TForm1.WMDROPFILES(var Message: TWMDROPFILES);var NumFiles : longint; i : longint; buffer : array[0..255] of char;begin {How many files are being dropped} NumFiles := DragQueryFile(Message.Drop,$FFFFFFFF,nil,0); {Accept the dropped files} for i := 0 to (NumFiles - 1) do begin DragQueryFile(Message.Drop,i,@buffer,sizeof(buffer)); Form1.Memo1.Lines.Add(buffer); end;end;{摘自delphi FAQ} delphi dbgrideh footer 有沒有鼠標單擊雙擊事件 每份编程工作半年之后 就开始厌烦工作 怎么办? delphi如何防止终止进程? 怎样将一个文件夹压缩成一个文件? 初次接触Delphi,哪位大虾能解释一下什么是VXD技术?谢谢!高分 如何实现更改货币符号(¥,$...)? 怎样建索引才合理? COM+中的事务问题? 一个关于MessageDlg()信息的汉化的问题…………………… 保存问题 一个继承TControl控制类,具有透明效果的按钮 怎样让程序在运行时完成自我复制,谢谢!!!!
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Memo1: TMemo;
procedure FormCreate(Sender: TObject);
private
procedure WMDROPFILES(var Message: TWMDROPFILES); message WM_DROPFILES;
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.DFM}uses ShellApi;procedure TForm1.FormCreate(Sender: TObject);
begin
{Let Windows know we accept dropped files}
DragAcceptFiles(Form1.Handle, True);
end;procedure TForm1.WMDROPFILES(var Message: TWMDROPFILES);
var
NumFiles : longint;
i : longint;
buffer : array[0..255] of char;
begin
{How many files are being dropped}
NumFiles := DragQueryFile(Message.Drop,$FFFFFFFF,nil,0);
{Accept the dropped files}
for i := 0 to (NumFiles - 1) do begin
DragQueryFile(Message.Drop,i,@buffer,sizeof(buffer));
Form1.Memo1.Lines.Add(buffer);
end;
end;
{摘自delphi FAQ}