Power Builder - GetFileOpenName....

 
Vista:

GetFileOpenName....

Publicado por Mª JOSE (33 intervenciones) el 19/11/2007 16:41:41
Hola a tod@s!!!

Estoy utilizando PB 7. Utilizando la función GetFileOpenName para seleccionar un archivo, me almacena el nombre ¿puedo además capturar su directorio, la fecha de creación del archivo y el tamaño del mismo? ¿Como puedo hacerlo?

Muchas gracias de antemano.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

Respuesta

Publicado por Leopoldo Taylhardat (710 intervenciones) el 19/11/2007 20:13:17
Saludos desde Maracay, Venezuela.

Con la función puedes obtener el nombre y la ruta completa+ el nombre (acceso) al archivo...

Para obtener otros datos hay que programar una función al SO...
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Respuesta

Publicado por Mª JOSE (33 intervenciones) el 20/11/2007 07:27:16
¿Puedes explicarmelo mejor?
GRACIAS
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Respuesta

Publicado por alberto (73 intervenciones) el 22/11/2007 12:35:47
bueno..
te preparé un ejemplo.
solamente utilicé las informaciones de fechas. la función en realidad devuelve MUCHO más que los datos de fechas.
fíjate en dwfileattributes, que contiene un long en donde están todas las informaciones de un archivo. Dejo a tu imaginación como usar and y or para bitwise operations : )

cualquier duda me la puedes consultar.

buena suerte.

//variables
ulong GetFileExInfoStandard = 0

//funciones externas
function ulong &
GetFileAttributesEx(ref string fileName, &
ulong infoLevel, &
ref win32_file_attribute_data info) &
library "kernel32" &
alias for "GetFileAttributesExA"

function ulong &
FileTimeToSystemTime(filetime ftime, &
ref systemtime stime) &
library "kernel32"

//estructuras
global type filetime from structure
long dwlowdatetime
long dwhighdatetime
end type

global type systemtime from structure
integer wyear
integer wmonth
integer wdayofweek
integer wday
integer whour
integer wminute
integer wsecond
integer wmilliseconds
end type

global type win32_file_attribute_data from structure
ulong dwfileattributes
filetime ftcreationtime
filetime ftlastaccesstime
filetime ftlastwritetime
ulong nfilesizehigh
ulong nfilesizelow
end type

//código de ejemplo. requiere tener un nombre de archivo en ls_path y
// un listbox llamado lb_1 en una ventana cualquiera.

string ls_path
string ls_file
win32_file_attribute_data info
int ret
systemtime stimecreation
systemtime stime
string ls_date
lb_1.reset( )
long ll_filesize

if getfileopenname("",ls_path,ls_file) <> 1 then return

lb_1.additem( "Get Info of " + ls_path )

ret = getfileattributesex( ls_path, GetFileExInfoStandard, info )

lb_1.additem( "Call Result = " + string(ret))

if ret = 0 then
lb_1.additem( "Cannot read file attributes")
return
end if

//fecha
ret = filetimetosystemtime( info.ftcreationtime , stimecreation )
if ret = 0 then
lb_1.additem( "Cannot read file creation time")
return
end if

ls_date = string(stimecreation.whour ) + "/" + &
string(stimecreation.wmonth ) + "/" + &
string(stimecreation.wyear )

lb_1.additem( "File created on " + ls_date )

ret = filetimetosystemtime( info.ftlastaccesstime , stimecreation )
if ret = 0 then
lb_1.additem( "Cannot read file last access time")
return
end if

ls_date = string(stimecreation.whour ) + "/" + &
string(stimecreation.wmonth ) + "/" + &
string(stimecreation.wyear )

lb_1.additem( "File last accessed on " + ls_date )

ret = filetimetosystemtime( info.ftlastwritetime , stimecreation )
if ret = 0 then
lb_1.additem( "Cannot read file last write time")
return
end if

ls_date = string(stimecreation.whour ) + "/" + &
string(stimecreation.wmonth ) + "/" + &
string(stimecreation.wyear )

lb_1.additem( "File last written on " + ls_date )

ll_filesize = long(info.nfilesizelow,info.nfilesizehigh)

lb_1.additem( "File size " + string( ll_filesize ))
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Respuesta

Publicado por alberto (73 intervenciones) el 22/11/2007 12:51:54
Te envié al correo que indicas como tuyo el ejemplo en un pbl
Está en PB9
Cordialmente.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Respuesta

Publicado por Mª JOSE (33 intervenciones) el 22/11/2007 14:04:40
Muchas gracias por tu ayuda!!

Lo probaré y te diré.

Saludos
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar