User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C# section within the Software Development category of DaniWeb, a massive community of 456,526 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,807 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C# advertiser: Programming Forums
Views: 2406 | Replies: 0
Reply
Join Date: Aug 2007
Posts: 16
Reputation: chait_anya is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
chait_anya chait_anya is offline Offline
Newbie Poster

Solution Mapping c# array with COM SAFEARRAY &/or BSTR

  #1  
Oct 2nd, 2007
Hi.
I am having a problem.
I have created .TLB type library in c#. in my c# application i have decalred two functions which returns string and string array respectively.
Now, i am importing the type library into vc++ 6.0 application.
i have created the interface pointer and using that pointer i am accessing the functions in that interface.
I am getting first character of the returned string when i call that function.
for eg.
BSTR myArr;
HRESULT hr = ptrInterface->getString(&myArr);

in myArr i am getting only first char of entire string, so how to get entire string?

In second senario, my code is

SAFEARRAY * arr;
HRESULT hr = ptrInterface->getArray(&arr);

i am getting some address in arr but coulden't get the values in the returned array.

So can you please tell me solution for above problems with sample code????

thanx n regards.
chaitanya.
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb C# Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the C# Forum

All times are GMT -4. The time now is 4:16 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC