拖拉打开文件

类别:Delphi 点击:0 评论:0 推荐:


Procedure DragDropFiles(Var message: TMessage); Message WM_DropFiles;

Procedure Tfm_main.DragDropFiles(Var message: TMessage);
Var
  p: Array[0..254] Of char;
  i: word;
Begin
  Inherited;
  i := DragQueryFile(Message.wParam, $FFFFFFFF, Nil, 0);
  For i := 0 To i - 1 Do
  Begin
    DragQueryFile(Message.wParam, i, p, 255);
  End;
  Try
    If FileExists(strPas(p)) Then
      OpenFile(strPas(p));
  Finally
    DragFinish(HDROP(Message.WParam));
  End;
End;

本文地址:http://com.8s8s.com/it/it4924.htm