Solved

problem on DCOM application?

Posted on 2002-04-15
4
202 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
[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
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
bobThere java chalenge 45 96
xyBalance chalenge 58 102
deburging in oracle form 12 112
List out all word 7 338
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

730 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