get新技能是需要付出行动的,即使看得再多也还是要动手试一试。今天图老师小编跟大家分享的是拖拉打开文件,一起来学习了解下吧!
【 tulaoshi.com - 编程语言 】
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://www.tulaoshi.com/n/20160219/1602163.html