知识大全 Shell.Application对象使用
Posted 知
篇首语:五陵年少金市东,银鞍白马渡春风。本文由小常识网(cha138.com)小编为大家整理,主要介绍了知识大全 Shell.Application对象使用相关的知识,希望对你有一定的参考价值。
Shell.Application对象使用 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!
创建 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 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);
cha138/Article/program/net/201311/13008相关参考
ASP讲座之三:Application对象与Session对象 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来
ASP内置对象Request对象详解 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧! 重新阅读基础
JavaScript对象化编程基本对象分析[3] 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!
JavaScript对象化编程基本对象分析[2] 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!
JavaScript对象化编程基本对象分析[1] 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!
JavaScript对象化编程全局对象分析[3] 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!
JavaScript对象化编程全局对象分析[2] 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!
JavaScript对象化编程全局对象分析[1] 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!
JavaScript对象化编程基本对象分析[6] 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!
JavaScript对象化编程基本对象分析[5] 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!