I tried adding more info headers to the listview.
I'm having issues with getting the correct date from files (FileTimeToLocalFileTime and FileTimeToSystemTime).
Like you can see, the timestamps it returns are complete gibberish.
I tried adapting the code from the following postings:
-
SKAN's ProcessCreationTime function
-
FileGetTime with milliseconds
- The different attempts at
DllCall: Basic FTP Functions
The minor changes I made to MiniClient.ahk to add the extra headers:
Code:
line 83:
Gui, 1:Add, ListView, x170 y%yOffset% w480 h200 gFileSelect AltSubmit vMiniFTP_ServerList hwndMiniFTP_hFileList -TabStop, Name | Size | Attrib | Path | Creation Time | Last access time | Last write time
line 356:
LV_Add("",GetItem(pFiles, ThisSelection . "_" . A_Index . "_Name"), GetItem(pFiles, ThisSelection . "_" . A_Index . "_Size") . " " . GetItem(pFiles, ThisSelection . "_" . A_Index . "_SizeType"), GetItem(pFiles, ThisSelection . "_" . A_Index . "_Attrib"), GetItem(pFiles, ThisSelection . "_" . A_Index . "_Path"), GetItem(pFiles, ThisSelection . "_" . A_Index . "_CreationTime"), GetItem(pFiles, ThisSelection . "_" . A_Index . "_LastAccessTime"), GetItem(pFiles, ThisSelection . "_" . A_Index . "_LastWriteTime"))
Different attempts at changing/adapting the FileTimeToStr function in FTP.ahk (none of which seem to work)
Code:
/*
FileTimeToStr(FileTime) {
VarSetCapacity(SystemTime, 16, 0)
DllCall("FileTimeToSystemTime", "uint", &FileTime, "uint", &SystemTime)
Return NumGet(SystemTime,2,"short")
. "/" . NumGet(SystemTime,6,"short")
. "/" . NumGet(SystemTime,0,"short")
. " " . NumGet(SystemTime,8,"short")
. ":" . NumGet(SystemTime,10,"short")
. ":" . NumGet(SystemTime,12,"short")
. "." . NumGet(SystemTime,14,"short")
}
*/
/*
; FileTimeToSystemTime: http://msdn2.microsoft.com/en-us/library/ms724280.aspx
;~ typedef struct _SYSTEMTIME {
;~ WORD wYear;
;~ WORD wMonth;
;~ WORD wDayOfWeek;
;~ WORD wDay;
;~ WORD wHour;
;~ WORD wMinute;
;~ WORD wSecond;
;~ WORD wMilliseconds;
;~ } SYSTEMTIME;
FileTimeToStr(ByRef @FileTime)
{
VarSetCapacity(SystemTime, 16, 0)
DllCall("FileTimeToLocalFileTime", "uint", &@FileTime, "uint", &@FileTime)
DllCall("FileTimeToSystemTime", "uint", &@FileTime, "uint", &SystemTime)
str .= NumGet(SystemTime, 0, "ushort")
str .= StrLen(Word := NumGet(SystemTime, 2,"ushort")) == 1 ? ("0" . Word) : Word
str .= StrLen(Word := NumGet(SystemTime, 6,"ushort")) == 1 ? ("0" . Word) : Word
str .= StrLen(Word := NumGet(SystemTime, 8,"ushort")) == 1 ? ("0" . Word) : Word
str .= StrLen(Word := NumGet(SystemTime, 10,"ushort")) == 1 ? ("0" . Word) : Word
str .= StrLen(Word := NumGet(SystemTime, 12,"ushort")) == 1 ? ("0" . Word) : Word
return str
}
*/
/*
FileTimeToStr(FileTime) {
DllCall( "FileTimeToLocalFileTime", Int64P,FileTime, Int64P,Local ), AT := 1601
AT += % Local//10000000, S
Return AT
}
*/
;/*
; FileTimeToSystemTime: http://msdn2.microsoft.com/en-us/library/ms724280.aspx
;~ typedef struct _SYSTEMTIME {
;~ WORD wYear;
;~ WORD wMonth;
;~ WORD wDayOfWeek;
;~ WORD wDay;
;~ WORD wHour;
;~ WORD wMinute;
;~ WORD wSecond;
;~ WORD wMilliseconds;
;~ } SYSTEMTIME;
FileTimeToStr(ByRef @FileTime)
{
VarSetCapacity(SystemTime, 16, 0)
DllCall("FileTimeToLocalFileTime", "uint", &@FileTime, "uint", &@FileTime)
DllCall("FileTimeToSystemTime", "uint", &@FileTime, "uint", &SystemTime)
;/*
str .= NumGet(SystemTime, 0, "ushort")
str .= StrLen(Word := NumGet(SystemTime, 2,"ushort")) == 1 ? ("0" . Word) : Word
str .= StrLen(Word := NumGet(SystemTime, 6,"ushort")) == 1 ? ("0" . Word) : Word
str .= StrLen(Word := NumGet(SystemTime, 8,"ushort")) == 1 ? ("0" . Word) : Word
str .= StrLen(Word := NumGet(SystemTime, 10,"ushort")) == 1 ? ("0" . Word) : Word
str .= StrLen(Word := NumGet(SystemTime, 12,"ushort")) == 1 ? ("0" . Word) : Word
return str
;*/
Loop 16 { ; Extracting and concatenating 8 words from a SYSTEMTIME structure
Word := Mod(A_Index-1,2) ? "" : *( &SystemTime +A_Index-1 ) + ( *(&SystemTime +A_Index) << 8 )
Time .= StrLen(Word) = 1 ? ( "0" . Word ) : Word ; Prefixing "0" for single digits
}
Return SubStr(Time,1,6) . SubStr(Time,9,8) ; YYYYMMDD24MISS
}
;*/
/*
FileTimeToStr( File, Mode="M" ) { ; Topic: www.autohotkey.com/forum/viewtopic.php?t=49194
;If ( VarSetCapacity($,342,0) && ( H:=DllCall( "FindFirstFile", Str,File, UInt,&$ ) ) ) {
;DllCall( "FindClose", UInt,H )
VC:=&$+4, VA:=&$+12, VM:=&$+20, FT:=V%Mode%
LFT:=&$+318 , DllCall( "FileTimeToLocalFileTime", UInt,FT, UInt,LFT )
ST:=LFT+8 , DllCall( "FileTimeToSystemTime", UInt,LFT, UInt,ST )
Loop 7
T .= StrLen( N:=NumGet(ST+0,(A_Index-1)*2,"UShort") ) < 2 ? "0" N : N
Return SubStr(T,1,6) . SubStr(T,9,8) . SubStr( "00" NumGet( ST+0,14,"UShort" ), -2 )
}
*/
Anybody?
