How to use shell.Application technology

xiaoxiao2021-04-07  325

About Shell.Application

-------------------------------------------------- ---------------------------------

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 () / * Returns the shellwindows object * /

Ffolder = shell.namespace (vdir) / * Returns the Folder object of the opened VDIR * /

Ofolder = shell.browseforfolder (HWND, Stitle, IOptions [, vrootfolder]) / * Select Folder dialog * /

/ * Example:

Function browsefolder ()

{

Var message = "Clear Select Folder";

Var shell = new activxObject ("shell.application");

Var folder = shell.browseforfolder (0, Message, 0x0040, 0x11);

IF (Folder! = null)

{

Folder = folder.Items (); // Return to FolderItems object

Folder = folder.Item (); // Return to FolderItem object

Folder = folder.path; // Return the path

IF (Folder.Charat (varFolder.Length-1)! = "//") {

Folder = varFolder "//";

}

Return Folder;

}

}

* /

/ * Example:

Var folder = shell.namespace ("c: //"); // Return to 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. Specifier The item or items to move. This Can be a string That Repesents 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 folload value. Thase Values ​​Are Based Upon Flags Defined for Use with the

Fflags Member of The C Shfileopstruct Structure. Thase Flags Are Not Defeed As Such for

Microsoft? Visual Basic ?, Visual Basic Scripting Edition (VBScript), or Microsoft Jscript ?, so you

Must define the yourself or use their numeric Equivalent.

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.

DISPLAY A Progress Dialog Box But Do Not Show The File Name.

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 Specifier The name of the item.

* /

OfolderItems = folder.items () // Retrieves a folderitems object this 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. Specifier 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. To. The INTEGER VALUE THAT INTEGER VALUE THE

Information Available for An Item Depends on The Folder In Which It Is Displayed. THIS VALUE

Corresponds to the zero-based column number what 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.

4 Retrieves The attributes of the item.

-1 Retrieves the info tip information for the item.

* /

4, use 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

[style =] folderItem.Type

[bislink =] FolderItem.islink

[bisfolder =] FolderItem.isfolder

[bisfilesystem =] FolderItem.isfilesystem

[bisbrowsable =] folderitem.isbrowsable

[ogetLink =] folderItem.getLink // Return to ShellLinkObject object

[OgetFolder =] folderItem.GetFolder // Return to Folder object

[omodifydate =] folderitem.modifydate (omodifydate) [= omodifydate] // sets or retrieves the date and time That the item.

Vverb = folderItem.verbs () // Returns the folderItemverbs 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 =] FolderItemverbs.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 to FolderItems object

* /

[OAPPLICATION =] FolderItemverbs.Application

[Oparent =] FolderItemverbs.parent

[oname =] folderItemverbs.name

FolderItemverb.doot () // 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

Combination of the folowing value.

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 cannot be resolved .hen this flag is set, The high-

Order Word of Fflags Specifies A Time-Out Duration, in Milliseconds. The Method Returns If The Link

Cannot 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 File That Contains the icon.

IINDEX Required. Integer That Is Set To The INDEX of The Icon In The File Specified by Spath.

* /

9, use shellwindows objects

[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 Reresents The shell window.

10, explanation

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 are found:

Shellapp.SHELLEXECUTE ("cmd.exe");

Shellapp.namespace (VDIR) .Items (). InvokeverBex (VVERB); / * VVERB: such as delete * /

Some special usages:

// 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 Specifier The URL of The New Favorite Item.

STYPE Required. A String Value That Specifies The Type of Item Being Added 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. Specifier The Width of The Component, in Screen Units.

Height Optional. Specifier The Height of The Component, in Screen Units.

* /

Rundll 32.exe User.exe, EXITWINDOWS

转载请注明原文地址:https://www.9cbs.com/read-132399.html

New Post(0)