Questions tagged [safearray]
145 questions
1
vote
1 answer
Accessing BSTR in SAFEARRAY
I am getting a SAFEARRAY ** which should contain "GOOG" and "O"
It looks good in the debugger
However I cannot get the BSTRs out!
This code
BSTR * raw;
HRESULT hr = SafeArrayAccessData(*Strings, (void **)&raw);
gives me
which crashes…

ravenspoint
- 19,093
- 6
- 57
- 103
1
vote
1 answer
How to release a SAFEARRAY within another SAFEARRAY
I am using a .NET component from MFC/C++ through a COM interface (using .NET Interop). The interface contains structures containing arrays (resulting in SAFEARRAYS in COM).
I am having trouble releasing the SAFEARRAYs in the correct way. When…

Rauhe
- 77
- 8
1
vote
3 answers
How do I create a variant array of BSTR in Euphoria using EuCOM?
So far I've figured out how to pass Unicode strings, bSTRs, to and from a Euphoria DLL using a Typelib. What I can't figure out, thus far, is how to create and pass back an array of BSTRs.
The code I have thus far (along with includes for EuCOM…

bugmagnet
- 7,631
- 8
- 69
- 131
1
vote
1 answer
Responsibility for memory deallocation in COM Interop
I'm working on a C++ code consuming services provided by a .NET dll, which I'm accessing via COM Interop. I'm writing both the C++ and C# side.
One of the methods that is exposed by the dll and is called from the C++, asks the dll
to return an…

user181218
- 1,655
- 5
- 28
- 42
1
vote
1 answer
Cannot convert ByRef VARIANT array to SAFEARRAY
I'm writing a C++ DLL to be accessed from Excel VBA (it is only completing mathematical equations and doesn't need to be accessed from the worksheet). The DLL is intended to replace current VBA code and I want to write it in C/C++ for performance. …

CuberChase
- 4,458
- 5
- 33
- 52
1
vote
1 answer
COM: pass reference to a SAFEARRAY
Introduction
I want to query a COM function with Qt. I have a documentation but for VB. Nevertheless this doc says:
Object.Frequencies DataArray
Object -> An object expression that evaluates to a BKDataSet object.
DataArray -> An array of…

Maxbester
- 2,435
- 7
- 42
- 70
1
vote
1 answer
Is this CComSafeArray usage bad?
I have a COM function:
GetData(SAFEARRAY ** pRetVal)
and following legacy code:
CComSafeArray saDataArray;
hr = pmyInterface->GetData(&saDataArray.m_psa);
SafeArrayLock(saDataArray);
I doubt if that is good to manually manage locks. Will…

Archer
- 507
- 1
- 8
- 21
1
vote
1 answer
How to retrieve a safearray (of struct) from COM object via ColdFusion 9
I am attempting to reference a COM object method defined as:
IEdmFile7::GetDerivedBOMs
Returns the derived (a.k.a. "named" or "saved") bills of materials associated with this file.
Prototype:
HRESULT GetDerivedBOMs( [out,ref] SAFEARRAY ( struct…

N W
- 11
- 1
1
vote
0 answers
COM Object that returns SAFEARRAY(Long) causing SafeArrayTypeMismatchException
I write plugins for a program that we use at work using a API Type library they provide. It is a COM object named SCAPI. The COM object was written for VB6 so when I add the reference for it it for .NET, an Interop version of it is created.
When I…

Roshmaster
- 113
- 1
- 1
- 6
1
vote
1 answer
Autogenerated C++ class from COM TypeLib doesn't return SAFEARRAY in method
Let me begin by stating, I'm not a COM developer. I know standard C++, C#, and Java.
I have a C# library that will be called from Managed C++. I've added C++ classes using Visual Studio 2010 --> MFC Class from TypeLib. The autogenerated C++ class…

Spidy
- 39,723
- 15
- 65
- 83
0
votes
0 answers
SafeArray structure: Is cDims ushort or uint?
In the definition of the SAFEARRAY data structure cDims is listed as USHORT
typedef struct tagSAFEARRAY {
USHORT cDims;
USHORT fFeatures;
ULONG cbElements;
ULONG cLocks;
PVOID pvData;
…

drgs
- 375
- 2
- 8
0
votes
1 answer
Calling COM from C++ using CoCreateInstance and IDispatch, with numerous parameters in DISPPARAMS incl. SAFEARRAY
I have a COM object which exposes a function. I would like to pass parameters to this function and receive a return value. I'm using C++ with CoCreateInstance(). The error I receive is:
hr = 0x8002000e : Invalid number of parameters.
I'm reasonably…

Gary
- 13
- 1
- 4
0
votes
1 answer
Accessing a SafeArray of Variants with JNI
I have a VB6 ActiveX DLL with functions that return a Variant. The Variant contains an array of node Variants, each of which contains a string Name and two data arrays (string and double). I am attempting to return this to a Java program as a…

winchella
- 162
- 2
- 11
0
votes
0 answers
What is the equivalent to the VBArray Object in Chromium?
I need to be able to convert a VBArray to a JavaScript Array using a Chromium JavaScript engine. This means the old IE method of var javascriptArray = new VBArray(input).toArray(); will not work. What would be alternatives to this?
In other words,…

clong
- 1
- 4
0
votes
1 answer
std::string assignment issue in VS2019, where it is working fine in VS2015
I am having an issue std::string assignment with the below code in VS2019, where it is working fine in VS2015.
I am using Visual Studio 2019 (v142) as Platform Toolset in VS2019 and Visual Studio 2015 (v140) as Platform Toolset in VS2015.
class…

aks
- 302
- 2
- 10