Propiedad FolderItem.IsFolder
Indica si el elemento es una carpeta.
Esta propiedad es de solo lectura.
bIsFolder = FolderItem.IsFolder
Valor booleano que recibe true si el elemento es una carpeta o false si no es así.
En el ejemplo siguiente se usa IsFolder para determinar si el directorio de Windows es una carpeta. Se muestra un uso adecuado para JScript, VBScript y Visual Basic.
Jscript:
<script language="JScript">
function fnIsFolderJ()
{
var objShell = new ActiveXObject("shell.application");
var objFolder2;
var ssfWINDOWS = 36;
objFolder2 = objShell.NameSpace(ssfWINDOWS);
if (objFolder2 != null)
{
var objFolderItem;
objFolderItem = objFolder2.Self;
if (objFolderItem != null)
{
var bReturn;
bReturn = objFolderItem.IsFolder;
}
}
}
</script>
Vbscript:
<script language="VBScript">
function fnIsFolderVB()
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.Self
if (not objFolderItem is nothing) then
dim bReturn
bReturn = objFolderItem.IsFolder
end if
set objFolderItem = nothing
end if
set objFolder2 = nothing
end if
set objShell = nothing
end function
</script>
Visual Basic:
Private Sub fnIsFolderVB()
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.Self
If (Not objFolderItem Is Nothing) Then
Dim bReturn As Boolean
bReturn = objFolderItem.IsFolder
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
Requisito | Value |
---|---|
Cliente mínimo compatible |
Windows 2000 Professional, Windows XP [solo aplicaciones de escritorio] |
Servidor mínimo compatible |
Windows 2000 Server [solo aplicaciones de escritorio] |
Encabezado |
|
IDL |
|
Archivo DLL |
|