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

  • Home
  • SEARCH
  • 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 9234565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:49:13+00:00 2026-06-18T06:49:13+00:00

I have the following COM visible property in a C# class: [ComVisible] bool[] Values;

  • 0

I have the following COM visible property in a C# class:

[ComVisible]
bool[] Values;

I have an instance of the class in C++ and used the following code to set this property (only pseudocode)

CComSafeArray<VARIANT_BOOL> values(3);
values[0] = VARIANT_FALSE;
values[1] = VARIANT_FALSE;

HRESULT hr = instance->put_Values(values.Detach());

The last line of the above code returns COR_E_SAFEARRAYTYPEMISMATCH (0x80131533). I tried with BYTE and VARIANT (with BOOL), but no success.

Can anyone please help?

  • 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-06-18T06:49:14+00:00Added an answer on June 18, 2026 at 6:49 am

    Took me a while to figure it out but I got it: pass VT_BOOL as the second template parameter to CComSafeArray:

    CComSafeArray<VARIANT_BOOL, VT_BOOL> values(3);
    

    Without that template parameter, the SAFEARRAY will be created with the VARTYPE VT_I2 (a 2-byte integer, because VARIANT_BOOL is an alias for short), which is not what a C# property of type bool[] expects.

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

Sidebar

Related Questions

We have a C#/.Net COM server (COM-visible assembly) with the following interface & class
I have the following code: import com.apple.dnssd.*; public interface IServiceAnnouncer { public void registerService();
I have following this blog in setting Xvfb in my ubuntu environment: http://corpocrat.com/2008/08/19/how-to-install-xvfb-x11-server-in-linux-server/ So
I have defined the following class using COM to use the IGroupPolicyObject using C#.NET:
I have the following code (from https://github.com/timabell/PageStructureBuilder ) and the ever knowledgeable ReSharper is
hi have a COM visible API in C# which looks like the following: public
We have an old asp application that instantiates a .NET com visible class. In
So basically I have the following code: Dim myIE As InternetExplorer: Set myIE =
I have the following interface which I'm trying to make COM-visible. When I try
i have following variables in jquery var uemail=abc@domain.com,xyz@domain.com,gty@domain.com; var subj=test message; var text=<b>This is

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.