Life of a techno-guru
Friday, June 09, 2006
  Using Oleview.exe to find scriptable COM objects
Hello everyone ... today, I have for you, a quick posting on how to use the Oleview program to locate COM objects that are scriptable in your daily VB scripting! I'm guessing that from the few search results on Google, that not many people are aware of this, but the Windows Resource Kit tools has a handy tool that allows you to view information about the type libraries registered with the COM server on a Windows computer. First, download and install the Windows 2003 resource kit, and then navigate to the folder you installed it to. Open up the oleview executable and browse around in it for a bit if you'd like.

The purpose of using this tool (at least my purpose) is to find some COM objects that I can use with VB script to do cool stuff. One particular object I came across is the Windows Media Player type library. This can be instantiated with the following code:
set playerobject = CreateObject("wmplayer.ocx")
For beginners out there who are asking "How do you know to use wmplayer.ocx?" I do have an answer! Using the oleview tool, you can figure out the name of the object you would like to create an instance of. If you'd like, follow along by opening up Oleview, and navigating to Objects Classes --> Grouped by Component Category --> Automation Objects --> Windows Media Player, and click that item. In the right-hand pane of Oleview, you'll see some information about the type library, and more specifically, the ProgID (or VersionIndependentProgID) of the object. This is what you need to know in order to create an instance of a COM object. While writing this article, I decided to randomly choose another object in the same list as another example, so go ahead and navigate to Microsoft Agent Control 2.0. Again, on the right side you should see the VersionIndependentProgID of "Agent.Control". By calling the built-in VBscript function CreateObject, you can instantiate this object as well.

Now, you might be asking yourself: "What can I do with this object once I've got an instance of it?" That will hopefully come in another article shortly as I'm running out of time, however, I will tell you that you can use Oleview to find out the answer for yourself. Happy scripting!
I've tried OLEView and while it works, it is too complicated a tool. Another tool that does about the same thing but in a more elegant & simplified fashion is the freeware iTripoli Type Library Viewer. I urge you to try it out.
Post a Comment

<< Home
My life of learning various things about technology including network administration, development, and 3D design

Location: Chicago, Illinois, United States
January 2006 / February 2006 / March 2006 / May 2006 / June 2006 / July 2006 / August 2006 / September 2006 / October 2006 / November 2006 / December 2006 / January 2007 / February 2007 / March 2007 / April 2007 / May 2007 / June 2007 / August 2007 / December 2007 / January 2008 / March 2008 / April 2008 / June 2008 / July 2008 / September 2008 / December 2008 / January 2009 / February 2009 / March 2009 / May 2009 /

Powered by Blogger