Solved

How can I pass array via COM ?

Posted on 2011-09-16
2
333 Views
Last Modified: 2012-05-12
Hi experts!

I have a VB6 application which pass command to a ActiveX OCX written in C by me. I should pass array like this

Dim sLogoPics() As String

  sLogoPics(1) = "C:\Logo001.tif"
  sLogoPics(2) = "C:\Logo002.tif"
 
  CPlay1.AnimationStaticPic(0,sLogoPics)

The question is – can I transfer a such array via COM (ActiveX) ? Here you also the declaration in C

long CCPlayCtrl::AnimationStaticPic(long lCard, type? sPicFile)
{
 // here I should get values of array in LPCTSTR. There no any other type which I can use as later I’ll need to pass LPCTSTR type to DLL from other software vendor.
LPCTSTR  sPicFinal[999];
I should get
sPicFinal[1]= “"C:\Logo001.tif"
sPicFinal[2]= “"C:\Logo002.tif"

Also I need advice what type to put here in place of VTS_BSTR. It should be one of primary OLE types as VB6 do not accept all OLE types.
 
DISP_FUNCTION(CCPlayCtrl, "AnimationStaticPic", AnimationStaticPic, VT_I4, VTS_I4 VTS_BSTR



I prefer to use only C code, not C++, but in final case I’ll use C++
0
Comment
Question by:dvplayltd
2 Comments
 
LVL 5

Accepted Solution

by:
Eduardo Goicovich earned 500 total points
ID: 36548050
You can use SAFE ARRAY structure as described here

http://support.microsoft.com/kb/207931/en-us

for string arrays take this link

http://support.microsoft.com/kb/118643/en-us
0
 

Author Closing Comment

by:dvplayltd
ID: 36548801
10x
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now