Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3301216
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:43:50+00:00 2026-05-17T20:43:50+00:00

I have a .Net asm with several interfaces and classes exposed to COM using

  • 0

I have a .Net asm with several interfaces and classes exposed to COM using the [ComVisible(true)] attribute. I generate a tlb, then reference this in my StdAdx file within a C++ COM component. What’s odd is that for some reason, even though the very basic intellisense (VS6 for C++) is able to see my properties and methods, I get compiler errors stating that they are not a member. For example:

[Guid("88E58BE4-E0CB-4d1b-9553-A5431E7A0BEA")]
[ComVisible(true)]
public interface ISupplierPayment : IBusinessObjectPersist
{
   String Comment
    {
        get;
        set;
    }

And in the generated tlh in c++:

struct __declspec(uuid("e94bd31e-327c-33c8-8a55-b693ccf1ed96"))
struct __declspec(uuid("e94bd31e-327c-33c8-8a55-b693ccf1ed96"))

ISupplierPayment : IDispatch
{
    //
    // Raw methods provided by interface
    //

    virtual HRESULT __stdcall get_Comment (
        BSTR * pRetVal ) = 0;

And finally the error when trying to use this in code:

D:\MR…File.cpp(647) : error C2039: ‘Comment’ : is not a member of ‘ISupplierPayment’
d:\mr…projectdir\release\TheDotNetClasses.tlh(758) : see declaration of ‘ISupplierPayment’

Any ideas what I should look at next? if it’s in the tlh and intellisense recognises it and it’s there in OLEView on the tlb, I’m not sure what could possibly be wrong.. thanks in advance for taking a look

UPDATE
Further example of related issue:
C#

    [Guid("3BE93D52-86B7-42e6-BAE6-29037F6BC9C4")]
    [ComVisible(true)]
public interface IDataStoreFactory
{
        void TestMethod(String test);

C++ TLH

struct __declspec(uuid("3be93d52-86b7-42e6-bae6-29037f6bc9c4"))
IDataStoreFactory : IDispatch
{
    //
    // Raw methods provided by interface
    //

    virtual HRESULT __stdcall TestMethod (
        BSTR dataStoreAssembly ) = 0;
            void TestMethod(String test);

C++ method call

spDataStoreFactory->TestMethod("test");

C++ compile error

‘TestMethod’ : cannot convert parameter 1 from ‘char [5]’ to ‘unsigned short *’
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

Huh!? it’s not a short it’s a BSTR… very confused now

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T20:43:50+00:00Added an answer on May 17, 2026 at 8:43 pm

    You didn’t show the calls generating the error message. I suppose you used the property name directly.

    You need to use the method get_Comment instead of simply Comment property. The generated tlh refers to that method. Did you used raw_interfaces_only attribute of the #import directive?

    Later edit about BSTR:

    BSTR is typedef for wchar_t*. So use spDataStoreFactory->TestMethod( SysAllocString(L"test"));

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my ASP.NET MVC application, I have the following setup: <runtime> <assemblyBinding xmlns=urn:schemas-microsoft-com:asm.v1> <probing
I have a .NET application, which is using an open source C++ compression library
I have ASP.NET web pages for which I want to build automated tests (using
I have a .NET assembly that contains classes to be registered as ServicedComponent through
I have a .net application calling to a COM component (C++) which in turn
I have a asp.net application, which used html templates to generate content and sends
If I have .Net Form with a component/object such as a textbox that I
Does .net have a way to determine whether the local filesystem is case-sensitive?
I have a .Net desktop application with a TreeView as one of the UI
I have a .NET 2.0 windows forms app, which makes heavy use of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.