Lab 8: Using the OLECOM Object Viewer

In this lab, you will become familiar with aspects of implementing COM objects and ActiveX controls. You will use the OLE/COM Object Viewer to browse through the registry and you will inspect both a COM object and an ActiveX control.

  • To open the OLE/COM Object Viewer
    1. Start Visual Studio.
    2. On the Tools menu, click OLE/COM Object Viewer.
    3. On the View menu, click Expert Mode. Then scroll down the list of folders at the left of the Viewer until you find the folder labeled All Objects.
    4. Click the plus sign at the left of this folder to obtain a list of all the COM objects and ActiveX controls appearing in the registry. Some entries appear as GUIDs. Other entries use string names.

  • To browse a COM object
    1. Scroll down the list of entries until you find ADODB.Connection. This object is the ADO Connection object that you will use in Lab 10.
    2. Click the ADO Connection object. Information about the object's registry entries appears in the right pane. Note the InprocServer32 entry, which contains the path to the DLL that implements the object.
    3. Click the plus sign at the left of this folder to obtain a list of all the interfaces supported by this COM object. The viewer should look like Figure 8.13.
    4. click to view at full size.

      Figure 8.13 The OLE/COM Object Viewer

      Several interfaces appear in this list. The IUnknown interface supports interface pointer retrieval. By implementing the IDispatch interface, scripting languages, such as VBScript, can access this COM object. The interface that clients use most frequently is the _Connection interface. This interface contains methods that allow you to connect to a data source.

    5. Click the _Connection interface. This action causes information about the interface to appear in the panel at the right.
    6. If you look under the CLSID entry in the panel at the right, you see that the InprocServer32 entry is oleaut32.dll—the Windows Automation marshaler. The use of the Automation marshaler to marshal this interface means that you have to use Automation-compatible types (types that can be packaged as a VARIANT) when passing arguments to and return values from any method supported by this interface.

      Below the TypeLib entry, you find the win32 key set to "C:\Program Files\ Common Files\ADO\MSADO15.DLL". This indicates that the type library is linked to the server DLL.

      Double click the _Connection interface. In response, you see the Default Interface Viewer dialog box.

    7. In the Default Interface Viewer dialog box, click View Type Info.
    8. In the ITypeInfo Viewer dialog box, click the plus sign at the left of the Methods folder.
    9. Scroll down the list of methods until you find the Open method.
    10. Click the Open method.
    11. In the panel at the right, you see detailed information about the method, as shown in Figure 8.14.
    12. click to view at full size.

      Figure 8.14 The ITypeInfo Viewer

      The first entry that you see is the dispatch identifier. Next, you see the arguments that your client application provides for this method. Note the use of Automation-compatible data types.

    13. Close the ITypeInfo Viewer dialog box.
    14. In the Default Interface Viewer dialog box, click Close.
    15. Click the minus sign to the left of the ADODB.Connection entry in the OLE/COM Object Viewer.

  • To browse an ActiveX control
    1. Scroll down the entries at the left of the OLE/COM Object Viewer until you find the Microsoft ADO Data Control.
    2. Click the entry named Microsoft ADO Data Control. At the right side of the Viewer, you see detailed information about this control.
    3. Under the CLSID, you see the InprocServer32 defined as "[system directory]\MSADODC.OCX". ActiveX controls typically reside in files that end with the extension .ocx. (However, these files are DLLs.)
    4. At the right side of the Viewer, you should see the key name Control. The inclusion of this key is another strong indicator that you are viewing an ActiveX control.
    5. Click the plus sign at the left of the Microsoft ADO Data Control entry in the left panel of the Viewer.
    6. You see a large number of interfaces supported by this entry. This list includes all the interfaces that most ActiveX control containers expect an ActiveX control to support.
    7. Double click the IAdodc interface beneath the Microsoft ADO Data Control entry.
    8. In the Default Interface Viewer dialog box, click View Type Info.
    9. Click the plus sign at the left of the Methods folder in the ITypeInfo Viewer dialog box to expand the Methods folder.
    10. Click any of the methods in the Methods folder. The dispatch identifier and the method signature appear in the panel at the right of the ITypeInfo Viewer dialog box.
    11. Close the ITypeInfo Viewer dialog box.
    12. On the Default Interface Viewer dialog box, click Close.
    13. Close the OLE/COM Object Viewer.


    Microsoft Press - Desktop Applications with Microsoft Visual C++ 6. 0. MCSD Training Kit
    Desktop Applications with Microsoft Visual C++ 6.0 MCSD Training Kit
    ISBN: 0735607958
    EAN: 2147483647
    Year: 1999
    Pages: 95

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