ShellFolderView.SelectItem method

Sets the selection state of an item in the view.

Syntax

ShellFolderView.SelectItem(
  vItem,
  dwFlags
)

Parameters

vItem [in]

Type: Variant*

The FolderItem object for which the selection state will be set.

dwFlags [in]

Type: Integer

A set of flags that indicate the new selection state. This can be one or more of the following values.

(0)

Deselect the item.

(1)

Select the item.

(3)

Put the item in edit mode.

(4)

Deselect all but the specified item.

(8)

Ensure the item is displayed in the view.

(16)

Give the item the focus.

Return value

This method does not return a value.

Remarks

FocusedItem can only be called on the local system. It will not work when run on a webpage over HTTP or UNC.

Examples

The following example shows the proper use of this method in JScript embedded in HTML.

<html>
<head>
<title></title>

<script language="JavaScript">
    function fnShellFolderViewSelectItemJ()
    {
        var objFolder;
        
        objFolder = WebOC.Document.Folder;
        if (objFolder != null)
        {
            var objFolderItem;
            
            objFolderItem = objFolder.Self;
            if (objFolderItem != null)
            {
                WebOC.Document.SelectItem(objFolderItem, 16);
                alert("item selected");
            }
        }
    }
    
    function fnLoad()
    {
        var webOC;
        
        webOC = document.all("WebOC");
        webOC.Navigate("C:\\");
    }
</script>

</head>
<body onload="fnLoad()">
<object id="WebOC"
        classid="clsid:8856F961-340A-11D0-A96B-00C04FD705A2"
        width=400
        height=400>
</object>
<br><br>
<INPUT id=SelectItem 
       type=button 
       value=SelectItem 
       name=SelectItem 
       onclick="fnShellFolderViewSelectItemJ()">
</body>
</html>

Requirements

Requirement Value
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)