Your Ad Here
首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 网站建设 > ASP.NET > [UMU WSH 教程](13)常见对象 - Shell.Application
【标  题】:[UMU WSH 教程](13)常见对象 - Shell.Application
【关键字】:UMU,WSH,13,Shell.Application
【来  源】:http://blog.csdn.net/UMU/archive/2007/04/18/1569147.aspx

[UMU WSH 教程](13)常见对象 - Shell.Application

Your Ad Here

  Shell.Application 对象由 Shell32.dll 提供,这次用更专业的 OleView 查看,可以获得这个对象有以下接口函数(省略 IDispatch 接口函数):

[id(0x60020000), propget, helpstring("Get Application object")]
HRESULT Application( [out, retval] IDispatch** ppid );

[id(0x60020001), propget, helpstring("Get Parent object")]
HRESULT Parent( [out, retval] IDispatch** ppid );

[id(0x60020002), helpstring("Get special folder from ShellSpecialFolderConstants")]
HRESULT NameSpace(
         [in] VARIANT vDir,
         [out, retval] Folder** ppsdf);

[id(0x60020003), helpstring("Browse the name space for a Folder")]
HRESULT BrowseForFolder(
         [in] long Hwnd,
         [in] BSTR Title,
         [in] long Options,
         [in, optional] VARIANT RootFolder,
         [out, retval] Folder** ppsdf);

[id(0x60020004), helpstring("The collection of open folder windows")]
HRESULT Windows( [out, retval] IDispatch** ppid );

[id(0x60020005), helpstring("Open a folder")]
HRESULT Open( [in] VARIANT vDir );

[id(0x60020006), helpstring("Explore a folder")]
HRESULT Explore( [in] VARIANT vDir );

[id(0x60020007), helpstring("Minimize all windows")]
HRESULT MinimizeAll();

[id(0x60020008), helpstring("Undo Minimize All")]
HRESULT UndoMinimizeALL();

[id(0x60020009), helpstring("Bring up the file run")]
HRESULT FileRun();

[id(0x6002000a), helpstring("Cascade Windows")]
HRESULT CascadeWindows();

[id(0x6002000b), helpstring("Tile windows vertically")]
HRESULT TileVertically();

[id(0x6002000c), helpstring("Tile windows horizontally")]
HRESULT TileHorizontally();

[id(0x6002000d), helpstring("Exit Windows")]
HRESULT ShutdownWindows();

[id(0x6002000e), helpstring("Suspend the pc")]
HRESULT Suspend();

[id(0x6002000f), helpstring("Eject the pc")]
HRESULT EjectPC();

[id(0x60020010), helpstring("Bring up the Set time dialog")]
HRESULT SetTime();

[id(0x60020011), helpstring("Handle Tray properties")]
HRESULT TrayProperties();

[id(0x60020012), helpstring("Display shell help")]
HRESULT Help();

[id(0x60020013), helpstring("Find Files")]
HRESULT FindFiles();

[id(0x60020014), helpstring("Find a computer")]
HRESULT FindComputer();

[id(0x60020015), helpstring("Refresh the menu")]
HRESULT RefreshMenu();

[id(0x60020016), helpstring("Run a Control Panel Item")]
HRESULT ControlPanelItem( [in] BSTR szDir );

[id(0x60030000), helpstring("get restriction settings")]
HRESULT IsRestricted(
         [in] BSTR Group,
         [in] BSTR Restriction,
         [out, retval] long* plRestrictValue);

[id(0x60030001), helpstring("Execute generic command")]
HRESULT ShellExecute(
         [in] BSTR File,
         [in, optional] VARIANT vArgs,
         [in, optional] VARIANT vDir,
         [in, optional] VARIANT vOperation,
         [in, optional] VARIANT vShow);

[id(0x60030002), helpstring("Find a Printer in the Directory Service")]
HRESULT FindPrinter(
         [in, optional] BSTR Name,
         [in, optional] BSTR location,
         [in, optional] BSTR model);

[id(0x60030003), helpstring("Retrieve info about the user's system")]
HRESULT GetSystemInformation(
         [in] BSTR Name,
         [out, retval] VARIANT* pv);

[id(0x60030004), helpstring("Start a service by name, and optionally set it to autostart.")]
HRESULT ServiceStart(
         [in] BSTR ServiceName,
         [in] VARIANT Persistent,
         [out, retval] VARIANT* pSuccess);

[id(0x60030005), helpstring("Stop a service by name, and optionally disable autostart.")]
HRESULT ServiceStop(
         [in] BSTR ServiceName,
         [in] VARIANT Persistent,
         [out, retval] VARIANT* pSuccess);

[id(0x60030006), helpstring("Determine if a service is running by name.")]
HRESULT IsServiceRunning(
         [in] BSTR ServiceName,
         [out, retval] VARIANT* pRunning);

[id(0x60030007), helpstring("Determine if the current user can start/stop the named service.")]
HRESULT CanStartStopService(
         [in] BSTR ServiceName,
         [out, retval] VARIANT* pCanStartStop);

[id(0x60030008), helpstring("Show/Hide browser bar.")]
HRESULT ShowBrowserBar(
         [in] BSTR bstrClsid,
         [in] VARIANT bShow,
         [out, retval] VARIANT* pSuccess);

[id(0x60040000), helpstring("Add an object to the Recent Docuements")]
HRESULT AddToRecent(
         [in] VARIANT varFile,
         [in, optional] BSTR bstrCategory);

[id(0x60050000), helpstring("Windows Security")]
HRESULT WindowsSecurity();

[id(0x60050001), helpstring("Raise/lower the desktop")]
HRESULT ToggleDesktop();

[id(0x60050002), helpstring("Return explorer policy value")]
HRESULT ExplorerPolicy(
         [in] BSTR bstrPolicyName,
         [out, retval] VARIANT* pValue);

[id(0x60050003), helpstring("Return shell global setting")]
HRESULT GetSetting(
         [in] long lSetting,
         [out, retval] VARIANT_BOOL* pResult);

  下面给例子,ShellApp.VBS,在 Win2003 测试通过:

Dim objSHA

Set objSHA = CreateObject( "Shell.Application" )

' 层叠窗口
objSHA.CascadeWindows

' 打开“Internet 选项”控制面板
objSHA.ControlPanelItem( "inetcpl.cpl" )

' 日期和时间 属性
objSHA.SetTime

' 打开任务栏属性
objSHA.TrayProperties

' 打开 C 盘
objSHA.Explore "C:\"

' 运行
objSHA.FileRun

'关机对话框
objSHA.ShutdownWindows

' 搜索文件
objSHA.FindFiles

' 打开 “我的电脑”
objSHA.ShellExecute "explorer.exe", "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}"

' 检测打印机服务是否在运行
MsgBox objSHA.IsServiceRunning( "Spooler" )

' 显示桌面
objSHA.ToggleDesktop

' Windows 安全
' 这个功能很多人用模拟 Ctrl+Alt+Del 的办法实现,代码千百行,难怪人称牛人!
'
Shell.Application 版本 4 有方法可以直接调用了!
objSHA.WindowsSecurity

Set objSHA = Nothing

  还是一句话:百度一下这些函数名,会有很多例子的! 

[UMU WSH 教程](14) 天下无敌 WMI 介绍:【上一篇】
诡异的JavaScript Closure:【下一篇】
【相关文章】
  • [UMU WSH 教程](14) 天下无敌 WMI 介绍
  • ORACLE:ORA-03113 /usr/lib/dld.sl: Unresolved symbol: gethrtime (code)
  • 13CList(EVC)
  • asp.net本周源码新鲜出炉(4-13)
  • [UMU WSH 教程](1) Hello WSH
  • [UMU WSH 教程](3)与 C 语言不一样的语法
  • [UMU WSH 教程](6)命令行参数
  • [UMU WSH 教程](7)WScript 对象
  • [UMU WSH 教程](8)脚本中的脚本
  • [UMU WSH 教程](9)CreateObject 过程
  • 【随机文章】
  • 用ASP实现悄悄话的功能
  • 破解 API Spy for NT v1.4(2)
  • ACCESS 如何用 Docmd.OutputTo 将查询导出为 Excel 97-2003 格式?
  • 下一代IT主流:服務導向架構
  • COM的内容
  • BT软件太优秀难以镇压 MPAA欲与之化敌为友
  • DELPHI基础教程--第一章 Delphi快速入门(四)
  • PowerPoint课件发布全攻略
  • 画椭圆的例子
  • 复制选项的规划
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 bbb软讯网络 All Rigths Reserved.