Click to Rate and Give Feedback
MSDN
MSDN Library
User Interface
Gadgets
Windows Sidebar
System.Shell.Folder
Methods
 copyHere Method
copyHere Method

Copies a System.Shell.Item to a folder.

Syntax

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

Parameters

oItem Required. The System.Shell.Item to copy.
intOptions Optional. 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.
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

No return value.

Remarks

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

Example

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++;
    }
}

Applies To

System.Shell.Folder
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker