Solved

How can I pass array via COM ?

Posted on 2011-09-16
2
339 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

770 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