CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2010
    Posts
    53

    Why Exception occured getting address of COM function ?

    Hello,

    I am getting address of COM function by loading type library (TLB) and iterating over types using ITypeLib and ITypeInfo.
    After calling AddressOfMember function of ITypeInfo I am facing following exception:

    System.Runtime.InteropServices.COMException (0x800288BD): Wrong module kind for the operation. (Exception from HRESULT: 0x800288BD (TYPE_E_BADMODULEKIND)) at System.Runtime.InteropServices.ComTypes.ITypeInfo.AddressOfMember(Int32 memid, INVOKEKIND invKind, IntPtr& ppv).

    Any idea how to get rid of this excpetion?



    Regards
    Usman

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Why Exception occured getting address of COM function ?

    Victor Nijegorodov

  3. #3
    Join Date
    Jan 2010
    Posts
    53

    Re: Why Exception occured getting address of COM function ?

    I've scan my registry..
    Registry corrected but problem still remained there. Alots of exceptions still while playing with AddressOfMember()..

    Still there..
    no change..
    Excpetion OccuredSystem.Runtime.InteropServices.COMException (0x800288BD): Wrong module kind for the operation. (Exception from HRESULT: 0x800288BD (TYPE_E_BADMODULEKIND))
    at System.Runtime.InteropServices.ComTypes.ITypeInfo.AddressOfMember(Int32 memid, INVOKEKIND invKind, IntPtr& ppv)

    :-(

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Why Exception occured getting address of COM function ?

    What is the invKind value?
    Note that:
    Fields and parameters that contain function invocation constants MUST contain a single INVOKEKIND value, and MUST NOT contain bitwise combinations of multiple INVOKEKIND values.
    The function invocation constants are defined in the INVOKEKIND enumeration.
    Code:
    typedef [v1_enum] enum tagINVOKEKIND
    {
        INVOKE_FUNC = 0x00000001,
        INVOKE_PROPERTYGET = 0x00000002,
        INVOKE_PROPERTYPUT = 0x00000004,
        INVOKE_PROPERTYPUTREF = 0x00000008
    } INVOKEKIND;
    Victor Nijegorodov

  5. #5
    Join Date
    Jan 2010
    Posts
    53

    Re: Why Exception occured getting address of COM function ?

    I've provided distinct invoke kind
    i.e

    System.Runtime.InteropServices.ComTypes.INVOKEKIND.INVOKE_FUNC under case of INVOKEKIND.INVOKE_FUNC.

    but still i am facing this exception. strange


    Excpetion OccuredSystem.Runtime.InteropServices.COMException (0x800288BD): Wrong module kind for the operation. (Exception from HRESULT: 0x800288BD (TYPE_E_BADMODULEKIND))
    at System.Runtime.InteropServices.ComTypes.ITypeInfo.AddressOfMember(Int32 memid, INVOKEKIND invKind, IntPtr& ppv)

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

Featured