Solved

problem on DCOM application?

Posted on 2002-04-15
4
181 Views
Last Modified: 2013-11-20
sir,
   I have created DCom application using win98 as a server and client as win2000.
I want to pass array of strings using variant and safearry.
My problem is that when iam passing VT_ARRAY  from the client after initializing ,but the server is recieving as VT_EMPTY.

actually i want retrieve array of strings from the server .using VARIANT and SAFEARRAY.
so please kindly solve this problem ,rectify and give me the datails.
          from
           sudhaonlinemail@yahoo.com
0
Comment
Question by:venkaiah
4 Comments
 
LVL 49

Expert Comment

by:DanRollins
ID: 6942971
First you say that you are passing VT_ARRAY from the client to the server, but then you say that you want to send the array from the server to the client.  Which is it?

Are you able to pass other data types successfully?

Please post the code that is failing.

-- Dan
0
 

Accepted Solution

by:
Biffa earned 100 total points
ID: 8444971
The structure I normally use for passing arrays of string across COM interfaces is A VARIANT containing a SAFEARRAY of BSTR.  The use of these types in my applications is restricted because I need to keep compatibility with Automation data types, but this structure is a good, flexible, and compatible solution for passing any data.

The parameter type to use in the IDL for this parameter is VARIANT.

The following code sample shows how to create and populate the structure described above.

#define StringCount 10;

VARIANT vStrings;
VariantInit (&vString);

vStrings.vt = VT_ARRAY|VT_BSTR;
vStrings.parray = ::SafeArrayCreateVector (VT_BSTR, 0, StringCount);

hR = ::SafeArrayLock (vString.parray);
if (FAILED (hR)) <insert error handling here>;

BSTR* pBSTR = static_cast<BSTR*>(vRights.parray->pvData);

for (int i = 0; i<StringCount; i++)
     pBstr++ = ::SysAllocString("MyString");

hR = ::SafeArrayUnlock (vRights.parray);
if (FAILED (hR)) <insert error handling here>;

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Powershell based monitoring system 2 137
Whole sheet autoscrub still needed 19 48
ORA-01403: no data found 43 89
Line meaning 9 81
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

948 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

20 Experts available now in Live!

Get 1:1 Help Now