关于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.
  */

 
从零到一:ArduPilot无人船PID调参实战指南 本文详细介绍了ArduPilot无人船PID调参的实战指南,从基础参数设定到高级调参技术,帮助用户掌握水面环境下的PID控制逻辑。通过案例分析和参数示例,解决无人船在空载、负载变化及不同水域环境中的航行问题,提升无人船的稳定性和精确度。 阅读详情

相关推荐

零成本实现飞牛 OS 内网穿透:CloudFlare 隧道搭建全攻略

一、引言:突破内网限制的最优解当你的内网环境中部署了飞牛 OS 系统(无论是老旧电脑还是 NAS 设备),想要实现公网访问时,传统方案往往面临两大痛点:公网 IP 申请困难且成本高DDNS 动态解析配置复杂专业内网穿透工具存在付费门槛今天为大家带来零成本解决方案:通过免费域名搭配 CloudFlare 隧道技术,无需公网 IP 即可轻松实现飞牛 OS 服务的公网访问。全程操作可视化,新手也能快速上手!二、前期准备:必备工具清单(1)域名准备。

Honmaple的博客 7493

如何使用Shell.Application技术

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

koolfoo的专栏 1914

企业微信会话存档SDK集成与动态库加载实战

本文详细解析了企业微信会话存档SDK的集成与动态库加载实战,重点解决Windows与Linux环境下动态库加载的差异问题。通过实战案例和优化建议,帮助开发者高效完成企业微信API集成,确保合规存档功能稳定运行。

weixin_26934905的博客 464

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

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

Gorden的博客 7436

保姆级教程:在RK3568上搞定PR2100K+GC2385双摄(从DTS配置到HAL层补丁)

本文详细介绍了在RK3568平台上调试PR2100K+GC2385双摄系统的完整流程,从DTS配置到HAL层补丁。涵盖硬件连接、媒体控制器拓扑验证、Camera3配置、HAL层特殊补丁及性能优化等关键步骤,帮助开发者快速解决双摄调试中的常见问题,提升嵌入式视觉系统开发效率。

weixin_28724661的博客 196

ZXDoc工业级CAN总线仿真工具全解析与应用实践

CAN总线作为现代工业通信的核心协议,其仿真技术是汽车电子和工业控制领域的关键支撑。通过物理层信号模拟、协议层报文解析和应用层人机交互的三维仿真,开发者能够构建完整的硬件在环测试环境。ZXDoc作为工业级仿真工具,集成了DBC工程化管理、HMI面板设计和自动化测试脚本等核心功能,特别适用于ECU开发、产线验证等场景。工具支持ISO11898标准协议,提供错误帧注入、负载压力测试等高级特性,结合Python API可实现复杂测试用例的自动化执行。在新能源车VCU测试等实践中,通过优化采样点等参数配置,显著提升

weixin_30096975的博客 471

VBS中使用的Shell.Application中ShellExecute方法详解

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

commandboy的博客 6924

基于SpringBoot 3 + Vue 3的全栈民宿预约管理系统设计与实现

文章将详细阐述系统的需求分析、架构设计、数据库设计、核心功能模块的实现(包括用户认证、房源管理、订单流程、支付集成等),并提供关键代码片段,最后对系统进行总结与展望。.requestMatchers("/api/admin/**").hasRole("ADMIN") // 管理员接口。.requestMatchers("/api/auth/**").permitAll() // 认证接口公开。.requestMatchers("/api/public/**").permitAll() // 公开资源。

2201_76125393的博客 272

关于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万+

Open3D (C++) 计算点云坐标最值及其索引

使用C++版本的Open3D计算点云最值点及其对应的下标索引

点云侠的博客 730

Open3D (C++) 使用点云创建数字高程模型DEM

Open3D (C++) 使用点云创建数字高程模型DEM

点云侠的博客 1392

使用Shell.Application对象

正常的情况下,注册表也许会认为Shell.Application对象是可用的,但由于它的某些功能需要更高的版本,所以你仍然需要检查Dll文件的版本号。你将看到WINDOWS资源管理器的查找文件对话框,这将允许你输入一个或多个扩展名来从你的硬盘查找符合扩展名的文件,还可以指定它包含指定的字符、并且/或在一个你指定的日期范围内编辑/建立。用VFP的人,有专业的,有非专业了,很多人其实是小白,问出的问题是小白,如果问题不对,我们引导他们问正确的问题。为了使你更深的理解它,你必须了解一些进程默认的常量。

加菲猫的VFP 191

基于matlab的CNN验证码识别系统(UI界面版)

基于matlab的CNN验证码识别系统(UI界面版),CNN验证码识别系统包括数据集处理、模型搭建、模型训练、界面设计与实现

在职AI算法工程师,擅长计算机视觉,YOLO目标检测、分割等,擅长web、pyqt界面可视化,好内容持续更新中,来这里跟大家一起学习,共同进步 484

使用Shell.Application技术之二 (转)

使用Shell.Application技术之二 (转)[@more@]function FileSearch(){SearchAsst = new ActiveXobject("SearchAssistantOC.Sear...

ciya3282的博客 322

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

SIMATIC S7-1200, S7-1500 PID 控制[手册]

SIMATIC S7-1200, S7-1500 PID 控制[手册]

使用Shell.Application技术之二

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

zcd_137的专栏 994

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

Stream、WshShell、WshUrlShortcut对象及Shell.Application的参数与使用

1.Stream对象 组件:"Adodb.Stream" 有下列方法: Cancel 方法 使用方法如下 Object.Cancel 说明:取消执行挂起的异步 Execute 或 Open 方法的调用。 Close 方法 使用方法如下 Object.Close :关闭对像 CopyTo 方法 使用方法如下 Object.C...

weixin_33701564的博客 105

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

C#使用系统的“显示桌面”功能(Shell.Application)

C#使用系统的“显示桌面”功能(Shell.Application) 原文C#使用系统的“显示桌面”功能(Shell.Application) 在 Windows 系统的 任务栏 上的 快速启动栏 里,通常有一个图标 ,点击这个图标,就会切换到桌面。这个图标实际是一个 “Windows Explorer Command” ,用记事本...

weixin_30532759的博客 197
上一篇: Wscript.Shell 对象详细介绍
下一篇: 面向对象的JavaScript编程
EndAll
博客等级 码龄20年 30粉丝 108原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值