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 / Interop / March 2005

Tip: Looking for answers? Try searching our database.

Variant containing SAFEARRAY problems

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Andrew S. Giles - 30 Mar 2005 23:11 GMT
Helllo all,

I have a COM server that exposes an explicit interface that has a method
that accepts a VARIANT datatype.  I want to use this to pass arrays of
integers/doubles/BSTR from my C++ app to a separate C# application.

I can move individual int, double, BSTR without a problem.

But when I try to utilize the VARIANT, I run into problems.  The only one
that works is the VARIANT which contains a SAFEARRAY, and I code the Variant
type (vt) to VT_I4 | VT_ARRAY.

If I use VT_R8 | VT_ARRAY or VT_BSTR | VT_ARRAY to send Arrays of doubles or
strings, for some reason the Event that is raised when the method is called
does not get the control (I dont stop at the breakpoint).

Does anyone have any idea qhy this might be happening?

Thanks in advance,

Andrew S Giles
Andrew S. Giles - 31 Mar 2005 17:25 GMT
Just as an update...

I have called the same method from the C# side (explicit call to the COM
server) with an Array of doubles, and it gets Marshalled to a VARIANT for the
COM server just fine.  I can look at it there, and all seems correct (VT =
8197 = VT_R8 | VT_ARRAY).

However, double checking the double array int he VARIANT from the C++ side
shows the same vt (8197) but the event raised is not caught.

Has anyone else heard of such a thing, or can anyone point me to a place
where I might get more information to fix this?

> Helllo all,
>
[quoted text clipped - 17 lines]
>
> Andrew S Giles

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.