The OLECOM Object Viewer

 < Free Open Study > 



The OLE/COM Object Viewer

Visual C++ ships with a great IDE-neutral browsing tool named the OLE/COM Object Viewer. Using this tool you are able to examine the COM objects installed on your local machine. Open this tool from the Visual C++ IDE using the Tools menu. You will notice a number of nodes in the left-hand pane tree view control:

click to expand
Figure 4-5: The various nodes of the OLE/COM Object Viewer.

As you can see from Figure 4-5, you may view type information, interface information, component category information (which we will learn all about in Chapter 9), and so on. In your next lab, you will be adding type information to your CoCar server developed in Chapter 3. When you have done so, you can expand the All Objects node, and hunt down your coclass. For the sake of discussion, assume you have already added some type information to CoCar, and wish to use the OLE/COM Viewer to examine its attributes.

In Figure 4-6, the CoCar object has been selected. Do note that when you expand a coclass sub-node, you have literally activated the object! For example, if you placed a MessageBox() call in the constructor of CoCar, you will see it pop up from the context of the OLE/COM Viewer utility.

click to expand
Figure 4-6: Expanding on a coclass will activate the object.

Beneath the CoCar is a listing of registered interfaces supported by the object. As we will see in the next chapter, a separate key of HKCR maintains information about the COM interfaces on your machine. Had we registered ICreateCar, IEngine, and IStats, we would see these listed as well. On the right-hand pane of the OLE/COM Object Viewer are a number of tabs, which allow you to examine registry information and implementation details, as well as set some security options for your coclass. Typically, you will make use of the dcomcnfg.exe utility to configure your COM objects; however, this tool allows you to establish certain security settings as well.

Using this tool is rather self-explanatory, and I will assume you will take the time to play with its functionality. One item is worth pointing out here and now: It is possible to examine the IDL code behind a given coclass. Most classes found from the All Objects node provide a context-sensitive View Type Information menu selection:

click to expand
Figure 4-7: Preparing to examine an object’s IDL code.

With this option selected, a separate window will appear, displaying the IDL code behind the COM object. As you can guess, this is a very handy way to learn about the IDL language (there are even copy/paste options in the tool to grab existing IDL code).

So now you can code, compile, and register type information for your C++ COM servers. If you are still looking for the major benefit of using IDL, the wait is over. The remainder of this chapter will examine how various programming languages (other than C++) can program against your coclasses using MIDL-generated type libraries.



 < Free Open Study > 



Developer's Workshop to COM and ATL 3.0
Developers Workshop to COM and ATL 3.0
ISBN: 1556227043
EAN: 2147483647
Year: 2000
Pages: 171

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net