确实不错,不过还有一个问题如果是自己应用程序中拖到windows中的窗口应如何实现呢?

解决方案 »

  1.   

    wzs:不明白什么是“自己应用程序中拖到windows中的窗口”
      

  2.   

    我的建议: 
       能否做成一个基于TComponent的非可视化控件?
       而不是基于TListBox的,或者别的什么。
       property DropEnabled:Boolean read FEnabled write FDropEnabled; 
       FDropEnabled 的命名规则有些混乱?
       应当为 SetDropEnabled 吧?(借鉴 Vcl 的源代码命名规范) 
       destructor 过程可以略去。   
       
       
      

  3.   

    Musicwind(风里来雨里去):说的是,控件是去年5月份写的,呵呵说实话,那时候,对vcl还不怎么熟悉
      

  4.   

    “自己应用程序中拖到windows中的窗口” 
    说的是你在自己的程序中,拖动某个东西,比如一个TListView的一个条目(Item)
    ,到IE的窗口中,希望创建一个特定的文件或者执行别的什么操作,怎么做?
    就象Winzip 一样,拖动一个文件到IE窗口中,Winzip将此文件解压出来了。
      

  5.   

    to Nicrosoft:我不想做控件,但我怎么也实现不了???还有我想把拖入文件到listview内。procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    begin
    DragAcceptFiles(listbox1.Handle,Enabled);//
    end;procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    var Mes:TMessage;
     FN:TStringList;
        FileName:array [1..256] of char;
        sFN:String;
        i,Count,p:integer;
    begin
      FN:=TStringList.Create;
      Count:=DragQueryFile(Mes.WParam,$FFFFFFFF,@FileName,256);//得到拖放文件的个数
      For i:=0 to Count-1 do
        begin
          DragQueryFile(mes.WParam,i,@FileName,256);//查询文件名称
          sFN:=FileName;
          p:=pos(chr(0),sFN);//去掉文件名末尾的ASCII码为0的字符
          sFN:=copy(sFN,1,p-1);
          FN.Add(sFN);
        end;
      DragFinish((mes.WParam); //释放所使用的资源
    listbox1.Items.AddStrings(fn);
      FN.Free;
    end;
      

  6.   

    DragAcceptFiles(self.Handle,Enabled);
                    ^^^^^^^^^^^为什么一定要指向这个句柄,我指向listbox1.handle就不能拖入listbox中了??