OLE/COM Object Viewer

上一篇 / 下一篇  2012-03-29 09:23:27 / 个人分类:AutoIt

OLE/COM Object Viewer
摘AutoIt Help

The "OLE/COM Object Viewer" is a very handy tool to get a peek on all COM objects currently installed on your system.  It is part of the Windows 2000 resource kit and can be downloaded for free from:http://www.microsoft.com/downloads/details.aspx?familyid=5233b70d-d9b2-4cb5-aeb6-45664be858b6&displaylang=en

The setup of this program is a bit awkward. It will not create any start menu icon for you. Instead, a file calledoleview.exewill be installed in theC:\Program Files\Resource Kitdirectory (default install).

When runningoleview.exe, some systems will complain about a missing file callediviewers.dll. This file is required, but strangely enough not included in the latest setup. You can obtain this dll from an older version of oleview.exe at:http://download.microsoft.com/download/2/f/1/2f15a59b-6cd7-467b-8ff2-f162c3932235/ovi386.exe.  It will install the files by default to the C:\MSTOOLS\BIN directory. You only need the file iviewer.dll. Copy it to the same directory where oleview.exe resides, then register the dll using the command line:regsvr32 iviewers.dll.

 

Let's do an example with the Oleviewer.  Run it and follow this tree:Object Classes->Grouped by Component Category->Control->Microsoft Web Browser

In the left column you see all COM Interfaces that have been defined for this object. We talk about those later. Take a closer look at the right column. It contains a lot of information to use this object in an AutoIt script. Most important is the "VersionIndependentProgID". This is the name to be used in an ObjCreate, ObjGet or ObjEvent function. Furthermore it contains the directory and filename that contains the object. This can be an EXE, a DLL or an OCX file.InProcServer32means that the object runs in the same thread as your script. (in-process). When you see LocalServer32,the object runs as a separate process. The object must also contain a type library (the lines following "TypeLib="), otherwise it can't be used in an AutoIt script. 

The interfaces in the left column are used for several ways of interacting with the object. Some are used for storage (IStorage, IPersist), others for embedding in a GUI (IOleObject, IOleControl). AutoIt uses the IDispatchinterface for automation. This interface 'exposes' all scriptable methods and properties that the object supports. If it does not exist, you can't use the object in an AutoIt script.

Let's take a look at this interface.  Right-click on the nameIDispatchand choose "View..." from the context menu. Then click the "View TypeInfo..." button.  (Note: if this button is grayed out, you did not have registered theiviewers.dllfile, or the object does not have a type library) 

 

The "ITypeInfo Viewer" window does only show the information that is provided with the object. If the developer decides not to include a help file, you will only see the names of the method/properties and nothing else. The "Microsoft Web Browser" type library is however quite extensive. Just click an item in the left column, and a description will be shown at the right. Sometimes you have to browse through "Inherited Interfaces" to retrieve more methods for the object.

The syntax of the described methods/properties are in C/C++ style. A property described as "HRESULT Resizable([in] VARIANT_BOOL pbOffline)", has to be rewritten in AutoIt like: $Resizable=$Object.Resizable  ($Object holds the object created with ObjCreate or ObjGet).

使用 OLE/COM 对象查看器

通过读取控件的类型库,OLE/COM 对象查看器使您得以查看控件的接口。

使用 OLE/COM 对象查看器

  1. 单击“工具”菜单上的“OLE/COM 对象查看器”或在命令行上键入“oleview”,启动 OLE/COM 对象查看器。

  2. 从“Object Classes”下的“Grouped by Component Category”打开“Automation Objects”文件夹,显示所有已注册的自动化对象。

  3. 向下滚动并选择其中一个控件。右窗格中会出现几个选项卡,由该控件实现的接口显示在“注册表”选项卡中。

    • 如果右击左窗格中的控件并选择“查看类型信息”,ITypeInfo 查看器将显示重建后的 .idl 或 .odl 文件。

    • 如果展开左窗格中的控件节点,将看到对象中的接口列表。如果单击某接口,该接口的注册表项将显示在右窗格中。

    • 如果右击某接口并单击“查看”,OLE/COM 对象查看器将显示一个对话框来显示该接口的 GUID,和一个用于查看类型库信息(如果该信息可用)的选项。选择“查看类型信息”将在 ITypeInfo 查看器中显示特定于该接口的重建 .idl 文件的一部分。

    • 在 ITypeInfo 查看器中,展开目录树视图并单击接口成员将在右窗格中显示访问器方法签名。


TAG:

引用 删除 felixDI   /   2020-05-07 00:05:35
引用 删除 taogeal   /   2013-10-22 15:31:56
3
 

评分:0

我来说两句

Open Toolbar