About Shell.Application ---------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------
1. Create a shell object var shell = new activityXObject ("shell.application"); 2, use shell attributes and methods
Shell.Application shell.parent
Shell.CascadeWindows () Shell.TileHorizontally () Shell.TileVertically () Shell.ControlPanelItem (sDir) / * For example: sysdm.cpl * / Shell.EjectPC () Shell.Explore (vDir) Shell.Open (vDir) Shell.FileRun () Shell.FindComputer () Shell.FindFiles () Shell.Help () Shell.MinimizeAll () Shell.UndoMinimizeALL () Shell.RefreshMenu () Shell.SetTime () Shell.TrayProperties () Shell.ShutdownWindows () Shell.Suspend () oWindows = Shell.Windows () / * returns ShellWindows objects * / fFolder = Shell.NameSpace (vDir) / * returns vDir open Folder object * / oFolder = Shell.BrowseForFolder (Hwnd, sTitle, iOptions [, vRootFolder ]) / * Select Folder Dialog * / / * Example: Function Browsefolder () {var message = "Clear Selection Folder";
Var shell = new activ ("shell.application"); var folder = shell.browseForfolder (0, Message, 0x0040, 0x11); if (folder! = null) {folder = folder.Items (); // Return FolderItems object Folder = folder.Item (); // Return FolderItem = folder.path; // Return path if (Folder.Charat (varFolder.Length-1)! = "//") {folder = varFolder "// "} Return folder;}} * /
/ * Example: Var folder = shell.namespace ("c: //"); // Return Folder object * / 3, use the Folder object [OAPPLICATION =] folder.Application // Contains the Application Object. [OparentFolder =] Folder .Parentfolder // contains the parent folder object. [Otitle =] Folder.title // Contains The title of the folder.
Folder.copyhere (Vitem [, VOptions]) // Copies An Item or items to a folder. Folder.movehere (VITEM [, VOPTIONS]) // Moves An Item or items to this folder. / * VItem: Required. Specifies the item or items to move. This can be a string that represents a file name, a FolderItem object, or a FolderItems object. vOptions Optional. Specifies options for the move operation. This value can be zero or a combination of the following values. These values are based upon flags defined for use with the fFlags member of the C SHFILEOPSTRUCT structure. These flags are not defined as such for Microsoft? Visual Basic ?, Visual Basic Scripting Edition (VBScript), or Microsoft JScript ?, so you must define them yourself or use their numeric equivalents. 4 Do not display a progress dialog box. 8 Give the file being operated on a new name in a move, copy, or rename operation if a file with the target name already exists. 16 Respond with "Yes To all "for any Dialog Box That is Displayed . 64 Preserve undo information, if possible. 128 Perform the operation on files 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. 2048 Version 4.71. Do not copy the security attributes of the file. 4096 Only operate in the local directory. Do not operate Recursively INTO Subdirector. 9182 Version 5.0. Do Not Move Connected Files As a Group. Only Move The Specified Files. * /
. Folder.NewFolder (bName) // Creates a new folder ppid = Folder.ParseName (bName) // Creates and returns a FolderItem object that represents a specified item / * bName:. Required A string that specifies the name of the item. . * / oFolderItems = Folder.Items () // Retrieves a FolderItems object that represents the collection of items in the folder. sDetail = Folder.GetDetailsOf (vItem, iColumn) // Retrieves details about an item in a folder. For example, its size, type, or the time of its last modification / * vItem:.. Required Specifies the item for which to retrieve the information This must be a FolderItem object iColumn:... Required An Integer value that specifies the information to be retrieved . The information available for an item depends on the folder in which it is displayed. This value corresponds to the zero-based column number that is displayed in a Shell view. for an item in the file system, this can be one of the following VALUES: 0 Retrieves the name of the it em. 1 Retrieves the size of the item. 2 Retrieves the type of the item. 3 Retrieves the date and time that the item was last modified. 4 Retrieves the attributes of the item. -1 Retrieves the info tip information for the item. * / 4, using the folderItems object
/ * Example: Var folderItems = shell.namespace ("c: //") .Items (); // Return FolderItems object * /
[OAPPLICATION =] folderItems.Application [iCount =] folderItems.count [Oparent =] folderItems.Parent
OfolderItem = folderItems.Item ([IIndex]) // Return to FolderItem object
5, use the folderItem object
/ * Example: Var folderItem = shell.namespace ("c: //") .Items (). Item (iIndex); // Return FolderItems object * /
[OApplication =] FolderItem.Application [oParent =] FolderItem.Parent [sName =] FolderItem.Name (sName) [= sName] [sPath =] FolderItem.Path [iSize =] FolderItem.Size [sType =] FolderItem.Type [ bIsLink =] FolderItem.IsLink [bIsFolder =] FolderItem.IsFolder [bIsFileSystem =] FolderItem.IsFileSystem [bIsBrowsable =] FolderItem.IsBrowsable [oGetLink =] FolderItem.GetLink // returns the object ShellLinkObject [oGetFolder =] FolderItem.GetFolder // returns Folder Object [oModifyDate =] FolderItem.ModifyDate (oModifyDate) [= oModifyDate] // Sets or retrieves the date and time that the item was last modified.vVerb = FolderItem.Verbs () // returns FolderItemVerbs the object. This object is the collection of Verbs That Can Be Executed on the item. FolderItem.invokeverb ([VVERB]) // Executes a Verb on the item.
6, use the folderItemverbs object
/ * Example: Var folderItem = shell.namespace ("c: //") .Items (). Item (iindex) .verbs (); // Return FolderItems object * / [OAPPLICATION =] folderItembs.Application [oparent =] FolderItemverbs.parent [icount =] folderItemVerbs.count
Overb = folderitemverbs.Item ([IIndex]) // Returns the folderItemverb object.
7, use the folderItemverb object
/ * Example: Var folderItem = shell.namespace ("c: //") .Items (). Item (iindex) .verbs (). Item (neyDex); // Return FolderItems object * /
[OAPPLICATION =] FolderItembs.Application [Oparent =] folderitemverbs.parent [oname =] folderItembs.name folderitemverb.doit () // Executes a verb on the folderItem Associated with the verb.
8, use the shelllinkObject object
[SWorkingDirectory =] ShellLinkObject.WorkingDirectory (sWorkingDirectory) [= sWorkingDirectory] [intShowCommand =] ShellLinkObject.ShowCommand (intShowCommand) [= intShowCommand] / * intShowCommand Integer that specifies or receives the link's show state. This can be one of the following values. 1 Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. 2 Activates the window and displays it as a minimized window. 3 Activates the window and displays it as a maximized window. * / [sArguments =] ShellLinkObject.Arguments (sArguments) [= sArguments] [sDescription =] ShellLinkObject.Description (sDescription) [= sDescription] [iHotkey =] ShellLinkObject.Hotkey (iHotkey) [= iHotkey] / * iHotkey Integer that specifies OR Receives The Link's Hot Key Code. The Virtual Key Code Is in The Low-Order Byte, And The Modifier Flags Are In The High-Order Byte. The Modifier Flags Can Be a Combi Nation of the folowing values. 1 Shift Key 2 Ctrl Key 4 Alt Key 8 Extended Key * / [spath =] shellLinkObject.path (spath) [= spath]
iIcon = ShellLinkObject.GetIconLocation (sPath) ShellLinkObject.Resolve (fFlags) / * fFlags Required. Flags that specify the action to be taken. This can be a combination of the following values. 1 Do not display a dialog box if the link can not be resolved. When this flag is set, the high-order word of fFlags specifies a time-out duration, in milliseconds. The method returns if the link can not be resolved within the time-out duration. If the high-order word is set to zero, the time-out duration defaults to 3000 milliseconds (3 seconds). 4 If the link has changed, update its path and list of identifiers. 8 Do not update the link information. 16 Do not execute the search heuristics. 32 Do not use distributed link tracking. 64 Disable distributed link tracking. By default, distributed link tracking tracks removable media across multiple devices based on the volume name. It also uses the Universal Naming Convention (UNC) path to track remote file systems whose drive letter has changed. Setting this flag disables both types of tracking. 128 Call the Microsoft? Windows? Installer. * / ShellLinkObject.Save ([sFile]) ShellLinkObject.SetIconLocation (sPath, iIndex) / * sPath Required. String value that contains the fully qualified path of the file that contains the icon. iIndex Required. Integer that is set to the index of the icon in the file specified by sPath. * / 9, using the object ShellWindows [intCount =] ShellWindows.Count
oShellWindows = ShellWindows._NewEnum () // Creates and returns a new ShellWindows object that is a copy of this ShellWindows object. oFolder = ShellWindows.Item ([iIndex]) // Retrieves an InternetExplorer object that represents the Shell window.
10. Description Create a shell object by the first step and perform related function calls, you can return the above objects and related operations. In addition, in the process of learning, two functions that have not been related in MSDN: shellapp.shellexecute ("cmd.exe"); shellapp.namespace (vdir) .Items (). InvokeverBex (Vverb); / * VVERB: If delete * / still special usage: // var myprinterfolder = shell.namespace ("shell: printersfolder"); // var mydocsfolder = shell.namespace ("shell: personal"); // var mycompfolder = Shell.namespace ("shell: drivefolder");
//Shell.Shellexecute ("WiaAcmgr.exe", "/ selectdevice"); //shell.shellexecute ("rundll32.exe", "shell32.dll, control_rundll sysdm.cpl, 1") //shell.shellexecute ( "Rundll32.exe", "shell32.dll, control_rundll netcpl.cpl, 1"); //shell.shellexecute ("rundll32.exe", "shell32.dll, control_rundll sysdm.cpl, 1");
The Following Command Will Run Run Rundll32.exe. Rundll32.exe
The Following Code Sample Shows How To Use the command. Rundll32.exe setupx.dll, installhinfsection 132 c: /windows/inf/shell.inf
//Shell.showbrowserbar ("" {C4EE31F3-4768-11D2-BE5C-00A0C9A83DA1} ", true);
I really don't know, there is nothing to call the function called, and MSDN is just a nine bull!
11, use shell.uihelper.1 object
Shellui = New ActiveXObject ("shell.uihelper.1");
ShellUI.AddChannel (sURL) ShellUI.AddFavorite (sURL [, vTitle]) bBool = ShellUI.IsSubscribed (sURL) // Indicates whether or not a URL is subscribed to. ShellUI.AddDesktopComponent (sURL, sType [, Left] [, Top ] [, Width] [, Height]) / * sURL Required. A String value that specifies the URL of the new favorite item. sType Required. A String value that specifies the type of item being added. This can be one of the following values: image The component is an image website The component is a web site left Optional Specifies the position of the left edge of the component, in screen coordinates Top Optional Specifies the position of the top edge of the component, in..... Spectany. Spect Optional. Specifies The Height Optional. Specifies The Height Optional. Specifies The Height Of The Component, in Screen Units. * / Rundll 32.exe User.exe, ExitWindows