拖放

var
  Form1: TForm1;
  filename, s, dir: string;
  attr, d, t: integer;
  f: text;
  cdir: array[0..256] of char;
implementation{$R *.dfm}
////////////////////////////////////////////////////////////////////////////////
procedure TForm1.AppOnMessage(var Msg: TMsg; var Handled: Boolean);           //
var                                                                           //
  WMD: TWMDropFiles;                                                          //
begin                                                                         //
  if Msg.message = WM_DROPFILES then                                          //
    begin                                                                     //
          //         MessageBeep(0);                                          //
      WMD.Msg := Msg.message;                                                 //
      WMD.Drop := Msg.wParam;                                                 //
      WMD.Unused := Msg.lParam;                                               //
      WMD.Result := 0;                                                        //
      WMDropFiles(WMD);                                                       //
      Handled := TRUE;                                                        //
    end;                                                                      //
                                                                              //
end;                                                                          //
////////////////////////////////////////////////////////////////////////////////
procedure TForm1.FormCreate(Sender: TObject);                    //           //
begin                                                            //           //
      DragAcceptFiles(form1.Handle, True);                       //           //
  //  DragAcceptFiles(Handle, True);                             //           //
  // DragAcceptFiles(Application.Handle, True);                  //           //
  Application.OnMessage := AppOnMessage;                         //           //
  //AnimateWindow(Self.Handle, 500, AW_BLEND or AW_ACTIVATE);    //           //
end;                                                             //           //
////////////////////////////////////////////////////////////////////////////////
procedure TForm1.WMDropFiles(var Msg: TWMDropFiles);                          //
var                                                                           //
  N: Word;                                                                    //
  buffer: array[0..180] of Char;                                              //
begin                                                                         //
                                                                              //
  with Msg do                                                                 //
    begin                                                                     //
      for N := 0 to DragQueryFile(Drop, $FFFFFFFF, buffer, 1) - 1 do          //
        begin                                                                 //
          DragQueryFile(Drop, N, Buffer, 180);                                //
          edit1.text := StrPas(Buffer);                                       //
        end;                                                                  //
      DragFinish(Drop);                                                       //
    end;                                                                      //
end;                                                                          //
////////////////////////////////////////////////////////////////////////////////
procedure TForm1.Button3Click(Sender: TObject);
begin
  AnimateWindow(Self.Handle, 500, AW_BLEND or AW_HIDE);
  close;
end;procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  AnimateWindow(Self.Handle, 500, AW_BLEND or AW_HIDE);
end;

你可能感兴趣的:(String,Integer,buffer,action,Blend)