Taburiss |
2004-09-01 10:58 |
只找到E文的解释~~懒得翻译啦~~ 反正呢~~格式是 sDetail = Folder.GetDetailsOf(vItem, iColumn) vitem部分,就是你要提取detial的对象,icolumn呢,就是相应的元素~~ icolumn 有 , 1,2,3,4和-1,分别对应 名称/容量/类型/最后修改时间/属性/infotip(这个是啥,我也不清楚) ,再有,返回值,当然就是你要求的值咯~~但是,是String类型~~~要注意~~ 原文如下~~~ GetDetailsOf Method
Retrieves details about an item in a folder. For example, its size, type, or the time of its last modification.
Syntax
sDetail = Folder.GetDetailsOf(vItem, iColumn)
Parameters
vItem Required. Specifies the item for which to retrieve the information. This must be a FolderItem object. iColumn Required. An Integer value that specifies the information to be retrieved. The information available for an item depends on the folder in which it is displayed. This value corresponds to the zero-based column number that is displayed in a Shell view. For an item in the file system, this can be one of the following values: 0 Retrieves the name of the item. 1 Retrieves the size of the item. 2 Retrieves the type of the item. 3 Retrieves the date and time that the item was last modified. 4 Retrieves the attributes of the item. -1 Retrieves the info tip information for the item.
Return Value
String containing the retrieved detail.
Remarks Note Not all methods are implemented for all folders. For example, the ParseName method is not implemented for the Control Panel folder (CSIDL_CONTROLS). If you attempt to call an unimplemented method, a 0x800A01BD (decimal 445) error is raised.
Examples The following example uses GetDetailsOf to retrieve the type of the file named Clock.avi. Proper usage is shown for Microsoft JScript, Microsoft Visual Basic Scripting Edition (VBScript), and Visual Basic.
JScript:
代码 | <script language="JScript"> function fnGetDetailsOfJ() { var objShell = new ActiveXObject("Shell.Application"); var objFolder = new Object; objFolder = objShell.NameSpace("C:\\WINDOWS"); if (objFolder != null) { var objFolderItem = new Object;
objFolderItem = objFolder.ParseName("clock.avi"); if (objFolderItem != null) { var objInfo = new Object;
objInfo = objFolder.GetDetailsOf(objFolderItem, 2); } } } </script>
|
VBScript:
代码 | <script language="VBScript"> function fnGetDetailsOfVB() dim objShell dim objFolder set objShell = CreateObject("Shell.Application") set objFolder = objShell.NameSpace("C:\WINDOWS")
if (not objFolder is nothing) then dim objFolderItem
set objFolderItem = objFolder.ParseName("clock.avi")
if (not objFolderItem Is Nothing) then dim objInfo objInfo = objFolder.GetDetailsOf(objFolderItem, 2) end if set objFolderItem = nothing end if set objFolder = nothing set objShell = nothing end function </script>
|
Visual Basic:
代码 | Private Sub btnGetDetailsOf_Click() Dim objShell As Shell Dim objFolder As Folder
Set objShell = New Shell Set objFolder = objShell.NameSpace("C:\WINDOWS") If (Not objFolder Is Nothing) Then Dim objFolderItem As FolderItem Set objFolderItem = objFolder.ParseName("clock.avi") If (Not objFolderItem Is Nothing) Then Dim szItem As String szItem = objFolder.GetDetailsOf(objFolderItem, 2) End If Set objFolderItem = Nothing End If Set objFolder = Nothing Set objShell = Nothing End Sub2 |
|
|