如何使用Shell.Application技术

Google 首页代码分析及简评     Google.cn 首页界面简洁,尤其是中下部“视频”“图片”“生活”等小图标的动画效果还很炫目。    几乎天天打开 google.cn 页面,有没有想到看看这个页面的 Html 代码是什么样子?当试图分析其 Html 代码时会发现,虽然页面看起来简单,但代码并不是想像的那么简单!    分析其代码发现:    以和表格混合布局,并不是所谓的纯粹的 XHTML +CSS 阅读详情

关于Shell.Application的使用
-----------------------------------------------------------------------------------

1、创建 Shell 对象
 var Shell = new ActiveXObject("Shell.Application");
 
2、使用 Shell 属性及方法

 Shell.Application
 Shell.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(0,Message,0x0040,0x11);
   if(Folder != null)
   {
    Folder = Folder.items(); // 返回 FolderItems 对象
    Folder = Folder.item();  // 返回 Folderitem 对象
    Folder = Folder.Path;  // 返回路径
    if(Folder.charAt(varFolder.length-1) != "//"){
     Folder = varFolder + "//";
    }
    return Folder;
   }
  }
  */

  /*示例:
  var Folder = Shell.NameSpace("C://");  // 返回 Folder对象
  */ 
 
3、使用 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 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. 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 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 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、使用 FolderItems 对象

  /*示例:
  var FolderItems = Shell.NameSpace("C://").Items(); // 返回 FolderItems 对象
  */

 [ oApplication = ] FolderItems.Application
 [    iCount    = ] FolderItems.Count
 [    oParent   = ] FolderItems.Parent

 oFolderItem = FolderItems.Item([iIndex])  // 返回 FolderItem 对象

5、使用 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 verbs that can be executed on the item.
 FolderItem.InvokeVerb( [vVerb])    // Executes a verb on the item.


6、使用 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 对象.

7、使用 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.

8、使用 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 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 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、使用 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、说明
 通过第一步创建 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 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 <dllname>,<entrypoint>,<optional arguments>

  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);

 真不知道,没有公开的函数调用还有多少,而msdn给我们的使用的只是九牛一毛而已!


11、使用 Shell.UIHelper.1 对象

        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 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

 

 

 

 

 

 

HFSS仿真的后处理结果,如何根据天线表面的电流密度分布对天线进行优化? 在HFSS仿真中,天线表面的Jsurf​是最直观、最有价值的诊断工具之一。它不仅告诉你天线“能不能工作”,还能告诉你“为什么工作”以及“哪里出了问题”。 阅读详情

相关推荐

验证 helm Chart 的正确性

验证 helm Chart 的正确性

小橙子的笔记屋 252

IE浏览器升级到谷歌浏览器——报错:ActiveXObject is not defined

if(document.all){//IE浏览器else{//非IE浏览器。

Gorden的博客 7384

三菱PLC程序源码-FX1N-60MR-001四柱粉末成型液压机PLC控制系统程序.zip

三菱PLC程序源码-FX1N-60MR-001四柱粉末成型液压机PLC控制系统程序

VBS中使用Shell.ApplicationShellExecute方法详解

最近在项目中偶然用到了使用VBS调用“shell.application”中的ShellExecute方法。在百度搜索一圈后发现很难找到关于这个方法的详细的中文教程。最后是在微软的官方文档中才找到了这个指令的详细英文教程。现将该方法的详细描述用中文分享给各位码友。 首先,VBS中调用该方法可以用Set Shell=CreateObject("Shell.Application")来创建对象。该方法的命令格式如下: Shell.ShellExecute "执行命令或文件的名称", "执行命令的附加参数",

commandboy的博客 6907

关于Shell.Application对象的一些简单尝试

<br />Set shellapp = CreateObject("Shell.Application")<br /> <br />'获取所有桌面的窗口:<br />Set oWindows = shellapp.Windows<br /> <br />'执行文件:<br />shellapp.ShellExecute("ipconfig.exe","/all")  <br />shellapp.ShellExecute("notepad.exe")<br /> <br />'创建子文件夹:<br /> 

软件自动化测试专栏 1万+

Shell.Application技术资料

<br />1、创建 Shell 对象<br /> var Shell = new ActiveXObject("Shell.Application");<br /> <br />2、使用 Shell 属性及方法<br /> Shell.Application<br /> Shell.Parent<br /> Shell.CascadeWindows()<br /> Shell.TileHorizontally()<br /> Shell.TileVertically()<br /> Shell.Contr

weiyifan2004的专栏 1514

使用Shell.Application技术之二

FileSearch() {  SearchAsst = new ActiveXObject("SearchAssistantOC.SearchAssistantOC");                SearchAsst.FindFilesOrFolders();                //ShellApp = new ActiveXObject("Shell.Applicatio

zcd_137的专栏 991

有关ActiveXObject的兼容性问题(浏览器的特有属性)

  这个问题还得从一开始时候学习有关javascript中有关对文件的一些操作。   对于每个前端的人应该都清楚有关File对象,其中包括多种方法,就不一一描述了,比如说她是通过FileSystemObject对象的GetFile()方法来创建的,其中的增删改查不太清楚的可以自行去理解。   接着上述的话题继续,有关创建File对象的时候,我们一般会定义一个fso对象变量,让其获得Fil...

赏樱看雪撸代码 1万+

基于Chrome浏览器调用客户端程序

基于Chrome浏览器调用客户端程序1.在IE中可以使用ActiveXObject对象调用客户端程序,调用需要设置IE浏览器的安全“自定义级别”,即将ActiveX选项的子项设置为启用。然后刷新即可调用,js调用方式:executableFullPath 为被调用的程序的所在目录;以Chrome调用QQ客户端为例: var executableFullPath = "E:/Boyce/soft

BoyceDream的博客 2万+

浏览器跨域常用解决方案总结

什么是跨域 跨域大家都知道,不同地址,不同端口,不同级别,不同协议都会构成跨域。例如:about.haorooms.com和www.haorooms.com都会构成跨域。总结起来只要协议、域名、端口有任何一个不同,都被当作是不同的域。 CORS 跨域资源共享 跨域资源共享(CORS) 是一种机制,它使用额外的 HTTP 头来告诉浏览器 让运行在一个 origin (domain) 上的Web应用被准许访问来自不同源服务器上的指定的资源。当一个资源从与该资源本身所在的服务器不同的域、协议或端口请求一个资源时

sinat_33255495的博客 929

ActiveX如何在Google上运行

前言: 此次技术为:用VS做的程序数据,通过微信给绑定公众号的人推送消息,因为微信公众号为接收数据不用访问我们的数据,所以我们用序列化,如果是微信号给咱们数据或者获取咱们的数据需要使用反序列化,现在我们以序列化为基础做一个Demo。 ...

萍踪侠影 1万+

安卓逆向笔记--apk加固

安卓逆向笔记–apk加固 资料来源: 浅谈安卓apk加固原理和实现 Android中的Apk的加固(加壳)原理解析和实现 一、apk常见加固方法 (1)代码层级加密–代码混淆         代码混淆是一种常见的加密方式。本质是把工程中原来具有含义的类名、变量名、方法名,修改成让人看不懂的名字。常见的代码混淆工具pro...

qq_43593334的博客 2706
下一篇: 使用Shell.Application技术之二
koolfoo
博客等级 码龄24年 2粉丝 4原创
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值