http://www.delphibbs.com/delphibbs/dispq.asp?lid=205675
怎样把网页上的超级链接拖到程序中
实现IDropTarget接口就可以了
CF_HDROP 是托文件,CF_TEXT是文本
-----------下面是我用上面的代码调用的方法
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, unit2, Activex;
type
TForm1 = class(TForm)
Edit1: TEdit;
Memo1: TMemo;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private declarations }
dd : TTMyDrop;
proceduredo
Droped(Sender: TObject;
Msg: Pchar);
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
Hr: HRESULT;
begin
OleInitialize(NIL);
dd := TTMyDrop.Create;
dd.OnDroped:=DoDroped;
Hr := CoLockObjectExternal(dd, true, false);
Hr := RegisterDragDrop(Handle, IDropTarget(dd));
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
RevokeDragDrop(Handle);
OleUninitialize;
end;
procedure TForm1.DoDroped(Sender: TObject;
Msg: Pchar);
begin
//
Memo1.Lines.Add(Msg)
end;
end.