powered by simpleCommunicator - 2.0.50     © 2025 Programmizd 02
Форумы / PowerBuilder [игнор отключен] [закрыт для гостей] / Атрибуты файла
5 сообщений из 5, страница 1 из 1
Атрибуты файла
    #32568980
PBWriter
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Господа, подкиньте плз функцию для определения даты последней модификации файла. Заранее спасибо.
...
Рейтинг: 0 / 0
Атрибуты файла
    #32568990
Black Savage
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
Date ld_BuildDate
Time lt_BuildTime

l_FileMan = CREATE pfc_n_cst_filesrvwin32

IF NOT l_fileman.of_getlastwritedatetime( 'you_file.exe', ld_BuildDate, lt_BuildTime ) = - 1  THEN
	// Вывод данных ld_BuildDate, lt_BuildTime 
END IF

destroy l_FileMan
...
Рейтинг: 0 / 0
Атрибуты файла
    #32568998
PBWriter
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
pfc не катит
...
Рейтинг: 0 / 0
Атрибуты файла
    #32569034
Black Savage
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
А что лениво взглянуть на код pfc_n_cst_filesrvwin32 для getlastwritedatetime и написать свой? Можно глянуть и на описание функции FindFirstFileA на сайте мелкософта ...
...
Рейтинг: 0 / 0
Атрибуты файла
    #32570480
Фотография Филипп
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Можно так (импортни):

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
$PBExportHeader$nvo_filetimeinfo.sru
forward
global type nvo_filetimeinfo from nonvisualobject
end type
type filetime from structure within nvo_filetimeinfo
end type
type systemtime from structure within nvo_filetimeinfo
end type
type win32_file_attribute_data from structure within nvo_filetimeinfo
end type
end forward

type filetime from structure
	unsignedlong		dwLowDateTime
	unsignedlong		dwHighDateTime
end type

type systemtime from structure
	unsignedinteger		wYear
	unsignedinteger		wMonth
	unsignedinteger		wDayOfWeek
	unsignedinteger		wDay
	unsignedinteger		wHour
	unsignedinteger		wMinute
	unsignedinteger		wSecond
	unsignedinteger		wMilliseconds
end type

type win32_file_attribute_data from structure
	unsignedlong		dwFileAttributes
	filetime		ftCreationTime
	filetime		ftLastAccessTime
	filetime		ftLastWriteTime
	unsignedlong		nFileSizeHigh
	unsignedlong		nFileSizeLow
end type

global type nvo_filetimeinfo from nonvisualobject autoinstantiate
end type

type prototypes
FUNCTION boolean GetFileAttributesExA(ref string name,int k,ref WIN32_FILE_ATTRIBUTE_DATA attr) LIBRARY "Kernel32.dll"
FUNCTION boolean FileTimeToSystemTime(ref FILETIME dd,ref SYSTEMTIME s1) LIBRARY "Kernel32.dll"
FUNCTION boolean FileTimeToLocalFileTime(ref FILETIME d1,ref FILETIME d2) LIBRARY "Kernel32.dll"
end prototypes

forward prototypes
public function integer getfilemoddate (readonly string szwhatfilename, ref string as_moddate)
end prototypes

public function integer getfilemoddate (readonly string szwhatfilename, ref string as_moddate); /*------------------------------------------------------------------------------

 Function:			public nvo_filetimeinfo.Getfilemoddate

 Returns:         Integer

 Parameters:      readonly String szwhatfilename
                  reference String as_moddate

 Copyright ©2003 DTI - Philip Salgannik

 Date Created: 3/26/2003

 Description:	
 
--------------------------------------------------------------------------------
 Modifications:
 Date            Author              Comments
------------------------------------------------------------------------------*/ 


WIN32_FILE_ATTRIBUTE_DATA fa
FILETIME fdt, fdt_local
SYSTEMTIME s_dt
boolean rtn
string sztmp

sztmp = szWhatFileName
IF NOT GetFileAttributesExA(sztmp, 0 ,fa) THEN 
	as_moddate = "Error - most likely Path is not Valid"
	RETURN - 1 
END IF

fdt.dwLowDateTime = fa.ftLastWriteTime.dwlowdatetime
fdt.dwHighDateTime = fa.ftLastWriteTime.dwhighdatetime

IF NOT FileTimeToLocalFileTime(fdt, fdt_local) THEN 
	as_moddate = "Could not convert to Local Time"
	RETURN - 1 
END IF 
IF NOT FileTimeToSystemTime(fdt_local,s_dt) THEN
	as_moddate = "Could not convert to System Time"
	RETURN - 1 
END IF
	

as_moddate = string(datetime(date(s_dt.wyear,s_dt.wmonth,s_dt.wday), &
								time(s_dt.whour,s_dt.wminute,s_dt.wsecond)),'yyyy-mm-dd hh:mm:ss')
								
RETURN  1 


end function

on nvo_filetimeinfo.create
call super::create
TriggerEvent( this, "constructor" )
end on

on nvo_filetimeinfo.destroy
TriggerEvent( this, "destructor" )
call super::destroy
end on
...
Рейтинг: 0 / 0
5 сообщений из 5, страница 1 из 1
Форумы / PowerBuilder [игнор отключен] [закрыт для гостей] / Атрибуты файла
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]