Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / September 2007

Tip: Looking for answers? Try searching our database.

Getting byte array from C# to ATL COM DLL

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
shiva - 18 Sep 2007 15:46 GMT
Hi,

I have a VC++ COM DLL which is making calls to C#.net DLL. The C#.net DLL
functions which are byte array expecting SAFEARRAY from VC++ DLL. VC++ DLL
get called from my VB client where I need to pass this SAFEARRAY as VARIANT
to VB.
Could anyone help me how to get byte array from C# into VC++ and pass it in
VARIANT to my VB client application.

The current code I wrote seems not working can anyone help me in this -

SAFEARRAY *psa;
SAFEARRAYBOUND aDataItemBounds[1];
aDataItemBounds[0].lLbound = 0;
aDataItemBounds[0].cElements = nLength;
   
psa = SafeArrayCreate( VT_ARRAY, 1, aDataItemBounds );

// call to .net method   
pInet->DotNetMethod(&psa, &lResult);

// copy into VARIANT to send to VB client
SafeArrayCopyData( psa, pVariant->parray);

Can anyone send me the code snippet for the above if it is wrongly coded.

Signature

Software Engineer

G Himangi - 19 Sep 2007 04:28 GMT
I dont think .Net can understand SAFEARRAYS.
In any case, it would be better to pass a normal array to the .Net method,
then pin it and copy its contents to a SAFEARRAY.

---------
- G Himangi,   Sky Software       http://www.ssware.com
Shell MegaPack : GUI Controls For Drop-In Windows Explorer like Shell
Browsing Functionality For Your App (.Net & ActiveX Editions).
EZNamespaceExtensions.Net : Develop namespace extensions rapidly in .Net
EZShellExtensions.Net : Develop all shell extensions,explorer bars and BHOs
rapidly in .Net
---------

> Hi,
>
[quoted text clipped - 23 lines]
>
> Can anyone send me the code snippet for the above if it is wrongly coded.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.