473,382 Members | 1,247 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Convert C# object To VARIANT of type binary format( VT_UI1+VT_ARRAY)

My aim is :- Pass C# object as a parameter of unmanaged Dll(vc++ 6.0)

method . with in the unmaaged dll methedod construct similar C++ class instance .
vice versa from dll method argument VARIANT result has to be converted to C# object

For this , I tried
Marshal.GetNativeVariantForObject(s, p);
or
Marshal.StructureToPtr(segInfo, ptrValue, false);

and
Marshal.GetObjectForNativeVariant(res)



But I got the error as like
An invalid VARIANT was detected during a conversion from an unmanaged VARIANT to a managed object. Passing invalid VARIANTs to the CLR can cause unexpected exceptions, corruption or data loss.


Source Files are attached
TestOne.zip is the VC++(6.0) unmanaged dll
TestACallFromDll.zip is C# application

Let me help as early as possible ....

Thanks In advance .

Regards,
Dileep S
Attached Files
File Type: zip TestACallFromDll.zip (49.8 KB, 93 views)
File Type: zip TestOne.zip (2.60 MB, 121 views)
Dec 5 '09 #1
0 2972

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Philipp Lenssen | last post by:
This drives me crazy: I have a file upload script to save an image on the disk (and later on in the database)... it used to work and now it doesn't, though I didn't change anything within the file...
0
by: Dino Hadzic | last post by:
Hallo csharp'ers I am trying to call a function on a COM (dll) object from managed c# code, which will send data to another node using an already existing bluetooth connection. However, I get a...
0
by: ChrisWoodruff | last post by:
I have a C++ function in a COM object that I am trying to implement in VB.NET (the functionality, NOT the COM object, I want to remove the requirement for the COM DLL) I am an experienced VB...
6
by: Arnshea | last post by:
(apologies for the crosspost) I'm working with an MFC based COM object. From C# I'd like to be able to call a method on the COM object that takes a string array and modifies the contents. Is...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.