您现在的位置:计算机技术学习网 > 技术中心 > WEB编程 > ASP >

如何使用Shell.Application技术

来源:未知 责任编辑:智问网络 发表时间:2013-11-10 20:09 点击:

关于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. Dont 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(iInd

    发表评论
    请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
    用户名: 验证码:点击我更换图片
    最新评论 更多>>

    推荐热点

    • WAP常见问题问答大全(四)
    • ASP开发必备:WEB打印代码大全
    • ASP调用系统ping命令
    • asp缓存技术
    • ASP教程:第三篇 ASP基础
    • 用ASP+XML打造留言本(4)
    • 关于ASP Recordset 分页出现负数解决方法及建议
    • 用asp怎样编写文档搜索页面(5)
    • ASP处理多关键词查询实例代码
    网站首页 - 友情链接 - 网站地图 - TAG标签 - RSS订阅 - 内容搜索
    Copyright © 2008-2015 计算机技术学习交流网. 版权所有

    豫ICP备11007008号-1