Windows Dev Center

Folder.ParseName method

Creates and returns a FolderItem object that represents a specified item.

Syntax


retVal = Folder.ParseName(
  bName
)

Parameters

bName [in]

Type: BSTR

A string that specifies the name of the item.

Return value

Type: FolderItem**

An object reference to the FolderItem object.

Remarks

ParseName should not be used for virtual folders such as My Documents.

Examples

The following example uses ParseName to create an object representing the folder item Clock.avi in the C:\Windows folder. Proper usage is shown for JScript, VBScript, and Visual Basic.

JScript:


<script language="JScript">
    function fnFolderObjectParseNameJ()
    {
        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)
            {
                //Add code here.
            }
        }
    }
</script>


VBScript:


<script language="VBScript">
    function fnFolderObjectParseNameVB()
        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
                'Add code here.
            end if
        end if

        set objFolder = nothing
        set objShell = nothing
    end function
</script>


Visual Basic:


Private Sub btnParseName_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")
            'Add code here.
            Debug.Print "passed"
        Set objFolderItem = Nothing
    End If

    Set objFolder = Nothing
    Set objShell = Nothing
End Sub


Requirements

Minimum supported client

Windows 2000 Professional, Windows XP [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Shldisp.h

IDL

Shldisp.idl

DLL

Shell32.dll (version 4.71 or later)

 

 

Community Additions

ADD
Show:
© 2015 Microsoft