Results 1 to 14 of 14

Thread: [newbie] Bunch of questions about COM

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2017
    Posts
    22

    Question [newbie] Bunch of questions about COM

    Hello,

    I have several newbie questions about COM:
    1. What is an interface?
    2. Is a new GUID generated every time a COM object is recompiled, so as to tell versions apart?
    3. For backward compatibility, must each new version of a COM object contain at least all the methods and properties from the previous version?
    4. Can multiple versions of a COM object co-exist on a computer?
    5. Can I prevent an application from installing an older version of a shared COM object so that my application doesn't break?
    6. Is there an application that can list an object's methods and properties, or is the object's documentation the only reliable source of info? I tried the OLE/COM Object Viewer and also RegDllView but they don't seem to provide that feature


    Thank you.

  2. #2
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    4,930

    Re: [newbie] Bunch of questions about COM

    1) An interface is a set of methods a class implementing the interface is guaranteed to have, and acts as a type you can cast a class instance to in order to call them.

    2) No, otherwise it wouldn't be the same component.

    3) That's what backwards compatibility essentially is, yes.

    4) Not if they have the same GUID. Trying will lead to conflicts.

    5) A well behaved installer should skip overwriting newer versions, but there's not much you can do to stop it without knowing exactly what you want to protect and denying access to it.

    6) That's the right app. You want to use the 'View TypeLib' feature under the file menu.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jun 2017
    Posts
    22

    Re: [newbie] Bunch of questions about COM

    Thanks.

    Since OLE/COM Object Viewer has no "find" function, I used Windows Explorer to locate a COM object I knew. File > View TypeLib" says:

    Code:
    IDataObject interface viewer only supports IID_IDataObject
    So I guess only some objects publish infos about themselves, and if not, Google is the way to go.

  4. #4
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    4,930

    Re: [newbie] Bunch of questions about COM

    It needs a type library in order to be used... I've never seen such a message before; if it's a built in COM object, which one? I'll take a look.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jun 2017
    Posts
    22

    Re: [newbie] Bunch of questions about COM

    MSXML

    As a newbie, I find it odd that OLEViewer has no "find" function. I had to use Windows Explorer to locate the DLL and provide its location.

    Name:  OleViewer.error.jpg
Views: 200
Size:  51.6 KB

  6. #6
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    4,884

    Re: [newbie] Bunch of questions about COM

    Make sure you use 32-bit version from "C:\Program Files (x86)\Microsoft Visual Studio\Common\Tools\OLEVIEW.EXE" to prevent binding errors.

    You can expand Type Libraries node and start typing to search by typelib name then in context menu select View... to show typelib viewer.



    cheers,
    </wqw>

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Jun 2017
    Posts
    22

    Re: [newbie] Bunch of questions about COM

    It's living in "C:\Program Files (x86)\Resource Kit"

    I don't know if it's 32 or 64 bits.

    Release 2.1.0.59

    When right-clicking > View…, it still says "OLE/COM Object Interface Viewer: IDataObject interface viewer only supports IID_IDataObject".

    --
    Edit: In the SDK, does someone where the OLE COM Object Viewer is, so I don't install the whole shebbang?

    Name:  Windows.SDK.jpg
Views: 191
Size:  36.6 KB
    Last edited by Winfried; Nov 24th, 2023 at 07:41 AM.

  8. #8
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    4,884

    Re: [newbie] Bunch of questions about COM

    This is from VS60 oleview.exe

    Code:
    File Type: WINDOWS EXECUTABLE
    
    File Version Information:
      File Version:                  2.1.0.54
      Product Version:               2.1.0.0
      File Type:                     0x00000001 (Application)
      File Subtype:                  0x00000000
      File Flags Mask:               0x0000003F
      File Flags:                    0x00000002
        Prerelease
      String File Information:       1033 (English (United States))
        Comments:                    OLE/COM Object Viewer 2.1
        CompanyName:                 Microsoft Corporation
        FileDescription:             OLEViewer Version 2.1
        FileVersion:                 2.10.054
        InternalName:                OLEViewer
        LegalCopyright:              Copyright © 1993-98 Microsoft Corporation.  All Rights Reserved.
        LegalTrademarks:             By Charlie Kindel, Michael Nelson, and Michael Antonio
        OriginalFilename:            oleview.EXE
        ProductName:                 OLEViewer
        ProductVersion:              2.1
    
    File Header:
      Machine:                       0x014C (Intel x86)
      Number of Sections:            3
      Time Date Stamp:               0x353038F0 (12.4.1998 5:45:52)
      Pointer to Symbol Table:       0x00000000
      Number of Symbols:             0
      Size of Optional Header:       0x00E0 (224)
      Characteristics:               0x030F
        Relocation info stripped from file
        File is executable
        Line numbers stripped from file
        Local symbols stripped from file
        32 bit word machine
        Debugging info stripped from file in .DBG file
    FYI, just checked out: both 64-bit and 32-bit oleview.exe can dump any typelib both in admin and non-admin execution context.

    cheers,
    </wqw>

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Jun 2017
    Posts
    22

    Re: [newbie] Bunch of questions about COM

    Thx

    So does the "Viewer: IDataObject interface viewer only supports IID_IDataObject" error message mean that particular COM object simply contains no typelib infos, and the only way to list its methods + properties is its traditional documentation?

  10. #10
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    4,884

    Re: [newbie] Bunch of questions about COM

    Quote Originally Posted by Winfried View Post
    Thx

    So does the "Viewer: IDataObject interface viewer only supports IID_IDataObject" error message mean that particular COM object simply contains no typelib infos, and the only way to list its methods + properties is its traditional documentation?
    Not COM object but a DLL i.e. COM server.

    Most common setup is for a COM server to have its typelib embedded as regular PE (portable executable) resource. Some DLLs even have more than one typelib resource e.g. MSVBVM60.DLL has three typelibs.

    It's possible a COM server to be stripped of any typelib resource and to have its typelib separate in an accompanying TLB file. It's a well known that a TLB file is actually a DLL file under the hood w/ no code sections but just having a typelib resource much like the common COM DLLs w/ typelib resource but without the actual code.

    In your case: I've seen this error before on my dev machine but it got away at some point by itself. Either Windows update or I just installed next version of Platform SDK -- it works here just fine on Win11 w/ version 10.0.22000 I'm currently using.

    cheers,
    </wqw>

  11. #11
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    4,930

    Re: [newbie] Bunch of questions about COM

    Something might be corrupt or just a bad version.

    I just went through and opened Windows\SysWOW64\msxml6.dll with OLEVIEW from: Visual Studio 6.0, Windows 10 SDK x86, and Windows 10 SDK x64, and they all opened it right up and displayed the type library.

    I'm attaching a saved copy of the IDL (source for .tlb) it generated here.
    Attached Files Attached Files

  12. #12

    Thread Starter
    Junior Member
    Join Date
    Jun 2017
    Posts
    22

    Re: [newbie] Bunch of questions about COM

    Thanks. I (obviously) don't know the difference between a COM object and a COM server —is an object a live, "actuated" server?

    Do I have the latest OLE/COM Viewer, and how I can tell it's 32 or 64 bits (if that makes a difference)?

    Name:  OLE.COM.Viewer.About.png
Views: 110
Size:  19.6 KB

    Name:  OLE.COM.Viewer.TypeLib.jpg
Views: 109
Size:  36.9 KB

  13. #13
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    4,930

    Re: [newbie] Bunch of questions about COM

    A COM server is an exe/dll that supplies COM objects, which are classes that implement COM interfaces.

    So when you create a DOMDocument60 object (in VB6 with 'New MSXML2.DOMDocument60', or by API with CreateObject("MSXML2.DOMDocument.6.0"), the actual code that runs when you call it's methods is in msxml6.dll, because msxml6.dll is the COM server, which supplies the default implementation of the DOMDocument60 COM object, which implements the IXMLDOMDocument3 interface and provides events through the XMLDOMDocumentEvents dispinterface.

  14. #14

    Thread Starter
    Junior Member
    Join Date
    Jun 2017
    Posts
    22

    Re: [newbie] Bunch of questions about COM

    Thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width