of_setlastwritedatetime


pfcapsrv.pbl   >   pfc_n_cst_filesrvunicode   >   of_setlastwritedatetime   

Full name pfc_n_cst_filesrvunicode.of_setlastwritedatetime
Access public
Extend of integer
Return value integer
Prototype public function integer of_setlastwritedatetime(string,date,time)

Name Datatype
No Data

Name Datatype
lb_Ret Boolean
lstr_Empty os_filedatetime
lstr_FileInfo os_fileopeninfo
lstr_FileTime os_filedatetime
lstr_FindData os_finddata
lul_Handle ULong

public function integer of_setlastwritedatetime (string as_filename, date ad_date, time at_time);//////////////////////////////////////////////////////////////////////////////
//	Public Function:  of_SetLastWriteDatetime
//	Arguments:		as_FileName				The name of the file to be updated.
//						ad_FileDate				The date to be set.
//						at_FileTime				The time to be set.
//	Returns:			Integer
//						1 if successful,
//						-1 if an error occurrs.
//	Description:	Set the Date/Time stamp on a file.
//////////////////////////////////////////////////////////////////////////////
//	Rev. History:	Version
//						5.0   Initial version
//						5.0.03	Changed long variables to Ulong for NT4.0 compatibility
//////////////////////////////////////////////////////////////////////////////
//	Copyright © 1996-1999 Sybase, Inc. and its subsidiaries.  All rights reserved.  Any distribution of the 
// PowerBuilder Foundation Classes (PFC) source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//////////////////////////////////////////////////////////////////////////////
Boolean						lb_Ret
ULong							lul_Handle
os_filedatetime			lstr_FileTime, lstr_Empty
os_finddata				lstr_FindData
os_fileopeninfo			lstr_FileInfo

// Get the file information.
// This is required to keep the Last Access date from changing.
// It will be changed by the OpenFile function.
lul_Handle = FindFirstFileW(as_FileName, lstr_FindData)
If lul_Handle <= 0 Then Return -1
FindClose(lul_Handle)

// Convert the date and time
If of_ConvertPBDatetimeToFile(ad_Date, at_Time, lstr_FileTime) < 0 Then Return -1

// Set the file structure information
lstr_FileInfo.c_fixed_disk = "~000"
lstr_FileInfo.c_pathname = as_FileName
lstr_FileInfo.c_length = "~142"

// Open the file
lul_Handle = OpenFile ( as_filename, lstr_FileInfo, 2 ) 
If lul_Handle < 1 Then Return -1
 
lb_Ret = SetFileTime(lul_Handle, lstr_Empty, lstr_FindData.str_LastAccessTime, lstr_FileTime)

CloseHandle(lul_Handle)

If lb_Ret Then
	Return 1
Else
	Return -1
End If
end function

     
Name Owner
No Data

     
Name Owner
pfc_n_cst_filesrvunicode.FindFirstFileW pfc_n_cst_filesrvunicode
pfc_n_cst_filesrvunicode.FindClose pfc_n_cst_filesrvunicode
pfc_n_cst_filesrvunicode.OpenFile pfc_n_cst_filesrvunicode
pfc_n_cst_filesrvunicode.CloseHandle pfc_n_cst_filesrvunicode
pfc_n_cst_filesrvunicode.SetFileTime pfc_n_cst_filesrvunicode
pfc_n_cst_filesrvunicode.of_convertpbdatetimetofile pfc_n_cst_filesrvunicode

     
Full name
pfc_n_cst_filesrvunicode.os_finddata
pfc_n_cst_filesrvunicode.os_fileopeninfo

     
Name Scope
No Data