Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #4  
Antiguo 31-03-2024
Avatar de MAXIUM
MAXIUM MAXIUM is offline
Miembro
 
Registrado: may 2005
Posts: 1.488
Poder: 21
MAXIUM Va camino a la fama
Add ShellAPI and Messages to your project's uses:
Código Delphi [-]
uses
    ShellAPI, Messages;
Add a method to your form that handles the WM_DROPFILES message.

For example, the following would be placed in the TForm1 declaration in the protected section:
Código Delphi [-]
protected
    procedure WMDropFiles(var Msg: TWMDropFiles); message WM_DROPFILES;
Drag 'n' drop are activated by calling:
Código Delphi [-]
DragAcceptFiles(Handle, true);
and deactivated by calling:

Código Delphi [-]
DragAcceptFiles(Handle, false);
It is normal to activate drag 'n' drop in the OnCreate event, and deactivate it in the OnClose or OnDestroy events:
Código Delphi [-]
procedure TForm1.FormCreate(Sender: TObject);
begin
  DragAcceptFiles(Handle, true);
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  DragAcceptFiles(Handle, false);
end;
This first procedure will enable you to drop files one at a time:
Código Delphi [-]
procedure TForm1.WMDropFiles(var Msg: TWMDropFiles);
var filename: PChar;
    length: LongWord;
begin
  length:= DragQueryFile(Msg.Drop, 0, NIL, 0);
  filename:= StrAlloc(length+1);
  DragQueryFile(Msg.Drop,0,filename,length+1);
  {do something with filename}
  Msg.Result:=0;
  inherited;
end;
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Comprobar el nombre de la imagen en un drag and drop. jjuguera Varios 7 16-01-2020 22:36:23
Drag and Drop con archivo adjunto de outlook izia Varios 7 24-02-2010 08:29:28
Drag&Drop para clasificar Imagenes gcaffe OOP 2 22-04-2007 21:43:16
Drag&Drop de un archivo a mi aplicacion... Ascii1457 Varios 6 15-10-2006 16:10:09
Ruta y nombre de archivo INI jfranco Varios 2 27-02-2004 16:44:23


La franja horaria es GMT +2. Ahora son las 20:29:23.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi