Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How can I pass array via COM ?

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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 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.

808 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