Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How can I pass array via COM ?

Posted on 2011-09-16
2
Medium Priority
?
356 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 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
Suggested Courses

971 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