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

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 21-09-2016
Avatar de lbidi
lbidi lbidi is offline
Miembro
 
Registrado: oct 2003
Ubicación: Montevideo- URUGUAY
Posts: 417
Poder: 21
lbidi Va por buen camino
Mover carpetas completas

Estimados, tengo el siguiente codigo obtenido de algun post de este club para mover una carpeta completa y sus archivos de un disco a otro.

Código Delphi [-]
function Tfrm_Main.MoveDir(const fromDir, toDir: string): Boolean;
var
  fos: TSHFileOpStruct;
begin
    ZeroMemory(@fos, SizeOf(fos));
    with fos do
    begin
        wFunc  := FO_MOVE;
        fFlags := FOF_FILESONLY;
        pFrom  := PChar(fromDir + #0);
        pTo    := PChar(toDir)
    end;
    Result := (0 = ShFileOperation(fos) );
end;
Por lo que he probado, utiliza alguna api de Windows para realizar este proceso y mi consulta es como puedo hacer para que no pregunte si deseo sobreescribir o "combinar" carpetas ? mi deseo es que mueva directamente sin preguntar. Es posible ?

Muchas gracias.
Responder Con Cita
  #2  
Antiguo 21-09-2016
Avatar de TOPX
TOPX TOPX is offline
Miembro
 
Registrado: may 2008
Ubicación: Bogotá
Posts: 527
Poder: 16
TOPX Va camino a la fama
Estimado, si quiere seguir utilizando TSHFileOpStruct, puede usar la propiedad fFlags para que la operación no pregunte eso que Ud. dice.

Para saber qué valores recibe, busque la declaración de FOF_FILESONLY en la unidad ShellApi de su versión de Delphi. Ahí junto con esa constante, están declaradas las otras que se pueden utilizar (FOF_MULTIDESTFILES, FOF_CONFIRMMOUSE, etc).
-
__________________
"constructive mind, destructive thoughts"
Responder Con Cita
  #3  
Antiguo 21-09-2016
Avatar de lbidi
lbidi lbidi is offline
Miembro
 
Registrado: oct 2003
Ubicación: Montevideo- URUGUAY
Posts: 417
Poder: 21
lbidi Va por buen camino
Muchas gracias TOPX, buscare informacion sobre ello.

Saludos
Responder Con Cita
  #4  
Antiguo 21-09-2016
Avatar de Neftali [Germán.Estévez]
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is offline
[becario]
 
Registrado: jul 2004
Ubicación: Barcelona - España
Posts: 18.271
Poder: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto
Yo he seguido más po menos el mismo camino...
https://msdn.microsoft.com/en-us/lib...(v=vs.85).aspx

Y llegas a los Flags:

Cita:
fFlags
Type: FILEOP_FLAGS
Flags that control the file operation. This member can take a combination of the following flags.

FOF_ALLOWUNDO
Preserve undo information, if possible.
Prior to Windows Vista, operations could be undone only from the same process that performed the original operation.
In Windows Vista and later systems, the scope of the undo is a user session. Any process running in the user session can undo another operation. The undo state is held in the Explorer.exe process, and as long as that process is running, it can coordinate the undo functions.
If the source file parameter does not contain fully qualified path and file names, this flag is ignored.

FOF_CONFIRMMOUSE
Not used.

FOF_FILESONLY
Perform the operation only on files (not on folders) if a wildcard file name (*.*) is specified.

FOF_MULTIDESTFILES
The pTo member specifies multiple destination files (one for each source file in pFrom) rather than one directory where all source files are to be deposited.

FOF_NOCONFIRMATION
Respond with Yes to All for any dialog box that is displayed.

FOF_NOCONFIRMMKDIR
Do not ask the user to confirm the creation of a new directory if the operation requires one to be created.

FOF_NO_CONNECTED_ELEMENTS
Version 5.0. Do not move connected files as a group. Only move the specified files.

FOF_NOCOPYSECURITYATTRIBS
Version 4.71. Do not copy the security attributes of the file. The destination file receives the security attributes of its new folder.

FOF_NOERRORUI
Do not display a dialog to the user if an error occurs.

FOF_NORECURSEREPARSE
Not used.

FOF_NORECURSION
Only perform the operation in the local directory. Do not operate recursively into subdirectories, which is the default behavior.

FOF_NO_UI
Windows Vista. Perform the operation silently, presenting no UI to the user. This is equivalent to FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_NOCONFIRMMKDIR.

FOF_RENAMEONCOLLISION
Give the file being operated on a new name in a move, copy, or rename operation if a file with the target name already exists at the destination.

FOF_SILENT
Do not display a progress dialog box.

FOF_SIMPLEPROGRESS
Display a progress dialog box but do not show individual file names as they are operated on.

FOF_WANTMAPPINGHANDLE
If FOF_RENAMEONCOLLISION is specified and any files were renamed, assign a name mapping object that contains their old and new names to the hNameMappings member. This object must be freed using SHFreeNameMappings when it is no longer needed.

FOF_WANTNUKEWARNING
Version 5.0. Send a warning if a file is being permanently destroyed during a delete operation rather than recycled. This flag partially overrides FOF_NOCONFIRMATION.
Ahí es cuestión de probar, pero este FOF_NOCONFIRMATION y este otro FOF_NOCONFIRMMKDIR tienen posibilidades.
__________________
Germán Estévez => Web/Blog
Guía de estilo, Guía alternativa
Utiliza TAG's en tus mensajes.
Contactar con el Clubdelphi

P.D: Más tiempo dedicado a la pregunta=Mejores respuestas.
Responder Con Cita
  #5  
Antiguo 21-09-2016
Avatar de lbidi
lbidi lbidi is offline
Miembro
 
Registrado: oct 2003
Ubicación: Montevideo- URUGUAY
Posts: 417
Poder: 21
lbidi Va por buen camino
Muchas gracias Neftali.

Justo estaba mirando esa info y me ha servido un monton.

Saludos
Responder Con Cita
Respuesta



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
Obtener HTML con ligas completas de paginas hechas con CMS sakuragi PHP 7 09-12-2010 22:23:47
Indy: Connection clode gracefully. Completas causas y solución ? rolandoj Internet 3 02-09-2008 11:44:39
pasar palabras completas de un memo a otro Cosgaya Conexión con bases de datos 1 05-06-2005 15:41:07
Impedir mover el form y redimensionar al mover barra tareas jealousy API de Windows 0 15-06-2004 12:58:05
Imprimir tablas completas en Rave Oreades Impresión 1 07-06-2004 07:43:40


La franja horaria es GMT +2. Ahora son las 17:08:20.


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