He visto este ejemplo (samples\dlgfile.prg):
- Code: Select all Expand view
#include "FiveWin.ch"
#define FO_MOVE 0x0001
#define FO_COPY 0x0002
#define FO_DELETE 0x0003
#define FO_RENAME 0x0004
#define FOF_MULTIDESTFILES 0x0001
#define FOF_CONFIRMMOUSE 0x0002
#define FOF_SILENT 0x0004 // don't create progress/report
#define FOF_RENAMEONCOLLISION 0x0008
#define FOF_NOCONFIRMATION 0x0010 // Don't prompt the user.
#define FOF_WANTMAPPINGHANDLE 0x0020 // Fill in SHFILEOPSTRUCT.hNameMappings
// Must be freed using SHFreeNameMappings
#define FOF_ALLOWUNDO 0x0040
#define FOF_FILESONLY 0x0080 // on *.*, do only files
#define FOF_SIMPLEPROGRESS 0x0100 // means don't show names of files
#define FOF_NOCONFIRMMKDIR 0x0200 // don't confirm making any needed dirs
#define FOF_NOERRORUI 0x0400 // don't put up error UI
#define FOF_NOCOPYSECURITYATTRIBS 0x0800 // dont copy NT file Security Attributes
#define FOF_NORECURSION 0x1000 // don't recurse into directories.
static oDlg
//----------------------------------------------------------------------------//
function Main()
DEFINE DIALOG oDlg TITLE "System Files management Dialogs"
@ 0.5, 1 BUTTON "&Copy" ACTION CopyFile( "dlgfile.exe", "c:\dlgfile.exe" ) ;
SIZE 30, 12
@ 1.5, 1 BUTTON "&Delete" ACTION DeleteFile( "c:\dlgfile.exe" ) ;
SIZE 30, 12
@ 2.5, 1 BUTTON "&Move" ACTION MoveFile( "dlgfile.exe", "c:\dlgfile.exe" ) ;
SIZE 30, 12
ACTIVATE DIALOG oDlg CENTERED
return nil
//----------------------------------------------------------------------------//
function CopyFile( cSource, cDestination )
return SHFile( oDlg:hWnd, FO_COPY, cSource + Chr( 0 ), cDestination )
//----------------------------------------------------------------------------//
function DeleteFile( cFileName )
return SHFile( oDlg:hWnd, FO_DELETE, cFileName + Chr( 0 ) )
//----------------------------------------------------------------------------//
function MoveFile( cSource, cDestination )
return SHFile( oDlg:hWnd, FO_MOVE, cSource + Chr( 0 ), cDestination )
//----------------------------------------------------------------------------/
pero aqui no pasa flags y lo he intentado pero no se en que posicion pasarlos y siempre me pide confirmacion.
- Code: Select all Expand view
SHFile( GetActiveWindow(), FO_DELETE, cFich + Chr( 0 ) , nAnd( FOF_ALLOWUNDO, FOF_NOCONFIRMATION ))
Tambien he intentado lo que me dices:
- Code: Select all Expand view
#include "FiveWin.ch"
#include "Fileio.ch"
#include "struct.ch"
#define FO_MOVE 0x0001
#define FO_COPY 0x0002
#define FO_DELETE 0x0003
#define FO_RENAME 0x0004
#define FOF_MULTIDESTFILES 0x0001
#define FOF_CONFIRMMOUSE 0x0002
#define FOF_SILENT 0x0004
#define FOF_RENAMEONCOLLISION 0x0008
#define FOF_NOCONFIRMATION 0x0010
#define FOF_WANTMAPPINGHANDLE 0x0020
#define FOF_ALLOWUNDO 0x0040
#define FOF_FILESONLY 0x0080
#define FOF_SIMPLEPROGRESS 0x0100
#define FOF_NOCONFIRMMKDIR 0x0200
#define FOF_NOERRORUI 0x0400
#define FOF_NOCOPYSECURITYATTRIBS 0x0800
#define FOF_NORECURSION 0x1000
function APapelera(cFich)
local oShFileOps
local nError
STRUCT oShFileOps
MEMBER hwnd AS LONG
MEMBER wFunc AS LONG
MEMBER pFrom AS STRING
MEMBER pTo AS STRING
MEMBER fFlags AS _INT
MEMBER fAnyOperationsAborted AS LONG
MEMBER hNameMappings AS LONG
MEMBER lpszProgressTitle AS STRING
ENDSTRUCT
oShFileOps:wFunc = FO_DELETE
oShFileOps:pFrom = cFich
oShFileOps:fFlags = nAnd( FOF_ALLOWUNDO, FOF_NOCONFIRMATION )
nError := ShFileOper(@oShFileOps)
return nError
DLL32 FUNCTION SHFileOper;
( @lpFileOp AS LPSTR ) ; // SHFILEOPSTRUCT
AS LONG PASCAL;
FROM "SHFileOperationA" LIB "SHELL32
pero en ejecucion me de un error al añadir el primer miembro de la estructura:
- Code: Select all Expand view
Application
===========
Path and name: D:\CHOCO\CHoCo.Exe (32 bits)
Size: 523,264 bytes
Time from start: 0 hours 0 mins 0 secs
Error occurred at: 12/08/2008, 11:23:13
Error description: Error BASE/1106 Argument error: REPLICATE
Args:
[ 1] = C
[ 2] = U
Stack Calls
===========
Called from: => REPLICATE(0)
Called from: TStruct.PRG => TSTRUCT:ADDMEMBER(0)
Called from: UTILS.PRG => APAPELERA(173)
Called from: CHOCO.PRG => MAIN(127)
System.......................
Total, que no le encuentro solucion. A ver si ve alguien algo porque no se porque el error.