Solved

How can I pass array via COM ?

Posted on 2011-09-16
2
345 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
[X]
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
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
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 switch statements in the C programming language.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month10 days, 1 hour left to enroll

623 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