System.Shell.Folder.copyHere Method

Copies a System.Shell.Item to a folder.

Syntax

System.Shell.Folder.copyHere(
  oItem,
  [ intOptions = 0 ]
)

Parameters

  • oItem [in]
    object Sets The System.Shell.Item to copy.
  • intOptions [in, optional]
    int Sets Integer that specifies any combination of copy operation options. Note   These values are based on flags defined for use with the fFlags member of the C++ SHFILEOPSTRUCT structure. These flags are not defined for Microsoft Visual Basic, Visual Basic Scripting Edition (VBScript), or Microsoft JScript, so you must define the values or use their numeric equivalents.
    Value Meaning
    0

    Default. No options specified.

    4

    Do not display a progress dialog box.

    8

    Rename the target file if a file exists at the target location with the same name.

    16

    Click "Yes to All" in any dialog box displayed.

    64

    Preserve undo information, if possible.

    128

    Perform the operation only if a wildcard file name (*.*) is specified.

    256

    Display a progress dialog box but do not show the file names.

    512

    Do not confirm the creation of a new directory if the operation requires one to be created.

    1024

    Do not display a user interface if an error occurs.

    4096

    Disable recursion.

    8192

    Do not copy connected files as a group. Only copy the specified files.

     

Return Value

This method does not return a value.

Remarks

A Shell folder object must be obtained from a System.Shell.Item using the SHFolder property in order to perform this call.

Examples

The following example demonstrates how to copy an object to a system folder.

// Member variables.
var oShellFolderItem;
var oShellFolder;

// --------------------------------------------------------------------
// Display the folder picker dialog and get a Shell.Item object 
// from the selection. A Shell folder object is also obtained.
// --------------------------------------------------------------------
function ChooseAFolder()
{
    oShellFolderItem = System.Shell.chooseFolder("SDK Choose Folder Example", 0);
    if (oShellFolderItem)
    {
        // Get a folder object from the System.Shell.Item.
        oShellFolder = oShellFolderItem.SHFolder;
    }
}

// --------------------------------------------------------------------
// Display the names of objects dropped on the gadget.
// Objects are deleted, copied, or moved as required.
// --------------------------------------------------------------------
function GetItemFromDrop()
{    
    var intIndex = 0;
    var oItem;
    while(oItem = System.Shell.itemFromFileDrop(event.dataTransfer, intIndex))
    {
        // Delete object as required.
        if (deleteDrop.checked == true)
        {
            System.Shell.RecycleBin.deleteItem(oItem.path);
        }
        
        // Copy object as required.
        if ((copyDrop.checked == true) && (oShellFolder!= null))
        {
            try
            {
                oShellFolder.copyHere(oItem, 8);
            }
            catch (e)
            {
                // Error handling.
            }
        }
        
        // Move object as required.
        if ((moveDrop.checked == true) && (oShellFolder != null))
        {
            try
            {
                oShellFolder.moveHere(oItem, 8);
            }
            catch (e)
            {
                // Error handling.
            }
        }
        
        intIndex++;
    }
}

Requirements

Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
IDL Sidebar.idl
DLL Sidebar.Exe version 1.00 or later

See Also

System.Shell.Folder

 

 

Send comments about this topic to Microsoft

Build date: 2/24/2010

Build type: SDK