How to use shell.Application technology

xiaoxiao2021-03-06  66

How to use the technology of Shell.Application: swords Source: ColorWolf: Swords nature: Translation Release date: 2004-08-15 Shell.Application of use on ------------------- -------------------------------------------------- -------------- 1, create a shell object var shell = new activXObject ("shell.application"); 2, use shell attributes and methods shell.Application shell.parent shell.cascadewindows () Shell.TILEHORIZONTALLY () shell.tilevertically () shell.controlPanelItem (SDIR) / * such as: 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 () / * Return shellWindows object * / ffolder = shell.namespace (vdir) / * Return to the open VDIR Folder object * / Ofolder = shell.browseFolder (hwnd, stitle, iptions [, vrootfolder]) / * Select Folder dialog * / / * example: function browsefolder () {var message = "Clear selection folder"; var shell = new activXObject ("shell.application"); v Ar folder = shell.browseforfolder (0, Message, 0x0040, 0x11); if (folder! = null) {folder = folder.Items (); // Return FolderItems object Folder = folder.Item (); // Return FolderItem object Folder = folder.path; // Return path if (Folder.Charat (varFolder.Length-1)! = "/") {Folder = varFolder "/";} Return Folder;}} * / / * Example: Var Folder = shell.namespace ("c: /"); // Returns the folder object * / 3, using 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 numeric equivalents. 4 Do not display a progress dialog box. 8 Give the file being operated their 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. DON '

t operate recursively into subdirectories. 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 COLU mn 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 item 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 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 FolderItem Object 5, use the FolderItem object / * Example: var folderItem = shell.namespace ("c: /"). Items (). Item (neyDex); // 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, using Folderite MVERBS object / * example: var folderItem = shell.namespace ("c: /"). items (). item (neyDex) .verbs (); // Return FolderItems object * / [OAPPLICATION =] folderItembs.Application [oparent = ] Folderitemverbs.parent [iCount =] folderItemverbs.count overb = folderItembs.item ([iIndex]) // Returns FolderItemverb object. 7. Using the FolderItemverb object / * Example: var folderItem = shell.namespace ("C: /"). Items (). Item (neyDex) .verbs (). Item (neyDex); // Return FolderItems object * / [OAPPLICATION =] folderItembs.Application [Oparent =] folderItemVerbs.parent [oname =

] FolderItemVerbs.Name FolderItemVerb.DoIt () // Executes a verb on the FolderItem associated with the verb. 8, using the object ShellLinkObject [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 combination of the following 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 lette r 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 this is a copy of this shellwindows object. Ofolder =

ShellWindows.Item ([iIndex]) // Retrieves An InternetExplorer Object That Repesents the shell window. 10, you can return the above objects by creating a shell object through the first step, and performing a related function call, you can return the above objects, and perform 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 Rundll32.exe Rundll32.exe , , The following code sample shows how to use the command Rundll32.exe Setupx... DLL, Installhinf/Shell.inf //shell.showbrowserbar ("", true); I really don't know, how much is there is no public function call, and M SDN is just the use of nine bulls! 11. Use shell.uihelper.1 object shellui = new activXObject ("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 screen coordinates. width optional. Specifies the width of the component, in screen units. Height . optional Specifies the height of the component, in screen units * / Rundll 32.exe User.exe, ExitWindows function FileSearch () {SearchAsst = new ActiveXObject ( "SearchAssistantOC.SearchAssistantOC");. SearchAsst.FindFilesOrFolders (); // ShellApp = new ActiveXObject ( "Shell.Application"); //ShellApp.ShowBrowserBar ( "", true); // the same effects} function PersonSearch () {SearchAsst = new ActiveXObject ( "SearchAssistantOC.SearchAssistantOC"); SearchAsst.FindPeople ();} function ShellExecuteExe () {ShellApp = new ActiveXObject ( "Shell.Application"); // var myprinterfolder = shell.NameSpace ( "shell: PrintersFolder"); // var mydocsfolder = shell.NameSpace ( " Shell: Personal "); // var mycompfolder = shell.namespace (" shell: drivefolder "); //shellapp.showbrowserbar (",);

ShellApp.ShellExecute ( "cmd.exe"); //ShellApp.ShellExecute("wiaacmgr.exe","/SelectDevice "); //ShellApp.ShellExecute("rundll32.exe", "shell32.dll, Control_RunDLL sysdm.cpl , 1 ") //shellapp.shellexecute ("Rundll32.exe", "shell32.dll, control_rundll netcpl.cpl, 1"); //shellapp.shellexecute ("Rundll32.exe", "shell32.dll, control_rundll Sysdm.cpl, 1 "); // You can use invokeverbex method //shellapp.namespace (" c, "); // and via Invokeverb (X); // .Items (). Item (0) .verbs (). Item (i) .name); Access a command // win = shellapp.namespace ("c: / xxx"). Items (). Item (0 ) // e = win.verbs (); // for (i = 0; i

~ // // BindToUrl // // Bind to the specified url and return the cdo object for it // function BindToUrl (szURL) {var adModeRead = 1;. Var oDoc = new ActiveXObject ( "CDO.KnowledgeDocument") oDoc. DataSource.open (Szurl, Null, AdmodeRead, -1, 0, "" "" ""} function msg (str) {//