FolderItem.ModifyDate 屬性
針對檔案,設定或取得上次修改的日期和時間。 針對資料夾,擷取上次修改資料夾的日期和時間,但無法加以設定。
這是可讀寫的屬性。
Syntax
iModifyDate = FolderItem.ModifyDate
FolderItem.ModifyDate = iModifyDate
屬性值
指定或接收上次修改專案的日期和時間的日期。
範例
下列範例會使用 ModifyDate 來擷取記事本的上次修改日期,然後將它重設為很長的時間。 JScript、VBScript 和 Visual Basic 會顯示適當的使用方式。
Jscript:
<script language="JScript">
function fnModifyDateGetSetJ()
{
var objShell = new ActiveXObject("shell.application");
var objFolder2;
var ssfWINDOWS = 36;
objFolder2 = objShell.NameSpace(ssfWINDOWS);
if (objFolder2 != null)
{
var objFolderItem;
objFolderItem = objFolder2.ParseName("NOTEPAD.EXE");
if (objFolderItem != null)
{
var szReturn;
szReturn = objFolderItem.ModifyDate;
objFolderItem.ModifyDate = "01/01/1900 6:05:00 PM";
}
}
}
</script>
VBScript:
<script language="VBScript">
function fnModifyDateGetSetVB()
dim objShell
set objShell = CreateObject("shell.application")
if (not objShell is nothing) then
dim objFolder2
dim ssfWINDOWS
ssfWINDOWS = 36
set objFolder2 = objShell.NameSpace(ssfWINDOWS)
if (not objFolder2 is nothing) then
dim objFolderItem
set objFolderItem = objFolder2.ParseName("NOTEPAD.EXE")
if (not objFolderItem is nothing) then
dim szReturn
szReturn = objFolderItem.ModifyDate
objFolderItem.ModifyDate = "01/01/1900 6:05:00 PM"
end if
set objFolderItem = nothing
end if
set objFolder2 = nothing
end if
set objShell = nothing
end function
</script>
Visual Basic:
Private Sub fnModifyDateGetSetVB()
Dim objShell As Shell
Dim objFolder2 As Folder2
Dim ssfWINDOWS As Long
ssfWINDOWS = 36
Set objShell = New Shell
Set objFolder2 = objShell.NameSpace(ssfWINDOWS)
If (Not objFolder2 Is Nothing) Then
Dim objFolderItem As FolderItem
Set objFolderItem = objFolder2.ParseName("NOTEPAD.EXE")
If (Not objFolderItem Is Nothing) Then
Dim szReturn As String
szReturn = objFolderItem.ModifyDate
objFolderItem.ModifyDate = "01/01/1900 6:05:00 PM"
Else
'FolderItem object returned nothing.
End If
Set objFolderItem = Nothing
Else
'Folder object returned nothing.
End If
Set objFolder2 = Nothing
Set objShell = Nothing
End Sub
規格需求
需求 | 值 |
---|---|
最低支援的用戶端 |
Windows 2000 專業版、Windows XP [僅限傳統型應用程式] |
最低支援的伺服器 |
Windows 2000 Server [僅限傳統型應用程式] |
標頭 |
|
Idl |
|
DLL |
|