1.Shell.Application对象使ç¨
Shell.Application对象使ç¨
ãã å建 Shell 对象var Shell = new ActiveXObject( Shell Application );ãã ä½¿ç¨ Shell å±æ§åæ¹æ³
ããShell ApplicationShell Parent
ããShell CascadeWindows()Shell TileHorizontally()Shell TileVertically()Shell ControlPanelItem(sDir) /* æ¯å¦ 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() /* è¿åShellWindows对象 */fFolder = Shell NameSpace(vDir) /* è¿åææå¼çvDirçFolder对象 */oFolder = Shell BrowseForFolder(Hwnd sTitle iOptions [ vRootFolder]) /* éæ©æ件夹对è¯æ¡ *//*ç¤ºä¾ function BrowseFolder(){ var Message = æ¸ éæ©æ件夹 ;
ããvar Shell = new ActiveXObject( Shell Application );var Folder = Shell BrowseForFolder( Message x x );if(Folder != null){ Folder = ems(); // è¿å FolderItems 对象Folder = em(); // è¿å Folderitem 对象Folder = Folder Path; // è¿åè·¯å¾if(Folder charAt(varFolder length ) != \\ ){ Folder = varFolder + \\ ;}return Folder;}}*/
ãã/*ç¤ºä¾ var Folder = Shell NameSpace( C:\\ ); // è¿å Folder对象*/
ãã ä½¿ç¨ Folder 对象
ãã[ 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 剑网1源码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 bination 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 Do not display a progress dialog box 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 Respond with Yes to All for any dialog box that is displayed Preserve undo information if possible Perform the operation on files only if a wildcard file name (* *) is specified Display a progress dialog box but do not show the file names Do not confirm the creation of a new directory if the operation requires one to be created Do not display a user interface if an error occurs Version Do not copy the security attributes of the file Only operate in the local directory Don t operate recursively into subdirectories Version 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: Retrieves the name of the item Retrieves the size of the item Retrieves the type of the item Retrieves the date and time that the item was last modified Retrieves the attributes of the item Retrieves the info tip information for the item */
ãã ä½¿ç¨ FolderItems 对象
ãã/*ç¤ºä¾ var FolderItems = Shell NameSpace( C:\\ ) Items(); // è¿å FolderItems 对象*/
ãã[ oApplication = ] FolderItems Application[ iCount = ] FolderItems Count[ oParent = ] FolderItems Parent
ããoFolderItem = FolderItems Item([iIndex]) // è¿å FolderItem 对象
ãã ä½¿ç¨ FolderItem 对象
ãã/*ç¤ºä¾ var FolderItem = Shell NameSpace( C:\\ ) Items() Item(iIndex); // è¿å FolderItems 对象*/
ãã[ 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 // è¿å ShellLinkObject 对象[ oGetFolder = ] FolderItem GetFolder // è¿å Folder 对象[ oModifyDate= ] FolderItem ModifyDate(oModifyDate) [ = oModifyDate ] // Sets or retrieves the date and time that the item was last modified
ããvVerb = FolderItem Verbs() // è¿å FolderItemVerbs 对象 This object is the collection of verbsthat can be executed on the item FolderItem InvokeVerb( [vVerb]) // Executes a verb on the item
ãã ä½¿ç¨ FolderItemVerbs 对象
ãã/*ç¤ºä¾ var FolderItem = Shell NameSpace( C:\\ ) Items() Item(iIndex) Verbs(); // è¿å FolderItems 对象*/
ãã[ oApplication = ] FolderItemVerbs Application[ oParent = ] FolderItemVerbs Parent[ iCount = ] FolderItemVerbs Count
ããoVerb = FolderItemVerbs Item( [iIndex]) // è¿å FolderItemVerb 对象
ãã ä½¿ç¨ FolderItemVerb 对象
ãã/*示ä¾
ããvar FolderItem = Shell NameSpace( C:\\ ) Items() Item(iIndex) Verbs() Item(iIndex); // è¿å FolderItems 对象*/
ãã[ oApplication = ] FolderItemVerbs Application[ oParent = ] FolderItemVerbs Parent[ oName = ] FolderItemVerbs Name
ããFolderItemVerb DoIt() // Executes a verb on the FolderItem associated with the verb
ãã ä½¿ç¨ 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 Activates and displays a window If the window is minimized or maximized the system restoresit to its original size and position Activates the window and displays it as a minimized window 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 bination of the following values SHIFT key CTRL key ALT key 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 bination of the following values Do not display a dialog box if the link cannot 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 cannot be resolved within the time out duration If the high order word is set to zero the time out duration defaults to milliseconds ( seconds) If the link has changed update its path and list of identifiers Do not update the link information Do not execute the search heuristics Do not use distributed link tracking 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 chaged Setting this flag disables both types of tracking 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 */
ãã ä½¿ç¨ 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
ãã 说æéè¿ç¬¬ä¸æ¥å建 Shell 对象 并è¿è¡ç¸å ³å½æ°è°ç¨ å°±å¯ä»¥è¿å以ä¸åç§å¯¹è±¡ 并è¿è¡ç¸å ³æä½ å¦å¤ å¨å¦ä¹ çè¿ç¨ä¸ åç°äºä¸¤ä¸ªå¨msdnä¸æåå´æ²¡ç¸å ³çå½æ° ShellApp ShellExecute( cmd exe );ShellApp NameSpace(vDir) Items() InvokeVerbEx(vVerb); /*vVerb:å¦delete*/
ããè¿æäºç¹æ®çç¨æ³ //var myprinterfolder = Shell NameSpace( shell:PrintersFolder );//var mydocsfolder = Shell NameSpace( shell:personal );//var mypfolder = Shell NameSpace( shell:drivefolder );
ãã//Shell ShellExecute( wiaacmgr exe /SelectDevice );//Shell ShellExecute( rundll exe shell dll Control_RunDLL sysdm cpl )//Shell ShellExecute( rundll exe shell dll Control_RunDLL netcpl cpl );//Shell ShellExecute( rundll exe shell dll Control_RunDLL sysdm cpl );
ããThe following mand will run Rundll exe Rundll exe <dllname> <entrypoint> <optional arguments>
ããThe following code sample shows how to use the mand Rundll exe Setupx dll InstallHinfSection C:\Windows\Inf\Shell inf
ãã//Shell ShowBrowserBar( { C EE F D BE C A C A DA } true);
ããçä¸ç¥é 没æå ¬å¼çå½æ°è°ç¨è¿æå¤å° èmsdnç»æ们ç使ç¨çåªæ¯ä¹çä¸æ¯èå·²!
ãã ä½¿ç¨ Shell UIHelper 对象
ããShellUI = new ActiveXObject( Shell UIHelper );
ãã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 ponent is an image website The ponent is a web site
ããLeft Optional Specifies the position of the left edge of the ponent in screen coordinates Top Optional Specifies the position of the top edge of the ponent in screen coordinates Width Optional Specifies the width of the ponent in screen units Height Optional Specifies the height of the ponent in screen units */
ããRundll exe User exe ExitWindows
ããfunction FileSearch() { SearchAsst = new ActiveXObject( SearchAssistantOC SearchAssistantOC ); SearchAsst FindFilesOrFolders(); //ShellApp = new ActiveXObject( Shell Application ); //ShellApp ShowBrowserBar( { C EE F D BE C A C A DA } true); //ä¸ä¸ææç¸å }
ãã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 mypfolder = shell NameSpace( shell:drivefolder );
ãã//ShellApp ShowBrowserBar( { C EE F D BE C A C A DA } true);
ããShellApp ShellExecute( cmd exe );
ãã//ShellApp ShellExecute( wiaacmgr exe /SelectDevice ); //ShellApp ShellExecute( rundll exe shell dll Control_RunDLL sysdm cpl ) //ShellApp ShellExecute( rundll exe shell dll Control_RunDLLnetcpl cpl ); //ShellApp ShellExecute( rundll exe shell dll Control_RunDLL sysdm cpl );
ãã//对äºFolderItems对象å¯ä»¥ç¨InvokeVerbEx Method //ShellApp NameSpace( c:\\xxx ) Items() InvokeVerbEx( delete ); //èéè¿InvokeVerb(x Items() Item( ) Verbs() Item(i) Name);å¯ä»¥è®¿é®æ个å½ä»¤ // win = ShellApp NameSpace( c:\\xxx ) Items() Item( ) // e = win Verbs(); // for(i= ;i<e Count;i++){ // document writeln(e Item(i) Name); // } // win InvokeVerb(e Item( ) Name);
}ãã//=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ // // BindToSA // // Bind to the specified url and return the cdo object for it // function BindToSA(szURL){ var adModeRead = ; var oDoc = new ActiveXObject( CDO KnowledgeStartAddress ) oDoc DataSource Open(szURL null adModeRead ) return oDoc; }
ãã//=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ // // BindToUrl // // Bind to the specified url and return the cdo object for it // function BindToUrl(szURL){ var adModeRead = ; var oDoc = new ActiveXObject( CDO KnowledgeDocument ) oDoc DataSource Open(szURL null adModeRead ) return oDoc; }
ããfunction Msg(str){ //<object id=FolderControl classid= clsid: e fd ad d da c f f > //var FolderControl = new ActiveXObject( Tahoe FolderControl ); FolderControl TraceMsg(str); }
ããShellApp = new ActiveXObject( Shell Application ); //ShellApp ShowBrowserBar( { C EE F D BE C A C A DA } true);
ãã//ShellApp ShellExecute( Rundll exe shell dll SHCreateLocalServerRunDll { ac dc a eb bf ee e bfb} );
ãã//ShellApp ShellExecute( Rundll exe shdocvw dll OpenURL );//Internet å¿«æ·æ¹å¼ //ShellApp ShellExecute( Rundll exe msconf dll OpenConfLink );//SpeedDial //ShellApp ShellExecute( Rundll exe zipfldr dll RouteTheCall );//å缩æ件夹shdocvw dll OpenURL //ShellApp ShellExecute( Rundll exe netplwiz dll UsersRunDll );//ç¨æ·å¸æ· //ShellApp ShellExecute( Rundll exe shell dll Options_RunDLL );//æ件夹é项 //ShellApp ShellExecute( Rundll exe shell dll Options_RunDLL );//æ¾ç¤ºä»»å¡æ åå¼å§èå
ãã//ShellApp ShellExecute( rundll exe shell dll Control_RunDLL sysdm cpl )appwiz cpl NewLinkHere //ShellApp ShellExecute( rundll exe shell dll Control_RunDLLAsUser )
ãã//ShellUI = new ActiveXObject( Shell UIHelper ); //ShellUI AddFavorite( MSDN ) //ShellUI AddChannel( )
ããShellApp ShellExecute( c:\\windows\\system \\mshta exe C:\\xx hta )
ãã//var s = ShellApp ShellExecute( rundll exe kernel dll GetVersionExA + +so);
lishixinzhi/Article/program/net//