473,792 Members | 3,005 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

2 New Member
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.GetNati veVariantForObj ect(s, p);
or
Marshal.Structu reToPtr(segInfo , ptrValue, false);

and
Marshal.GetObje ctForNativeVari ant(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
TestACallFromDl l.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, 94 views)
File Type: zip TestOne.zip (2.60 MB, 122 views)
Dec 5 '09 #1
0 2999

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

Similar topics

4
10805
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 upload script itself. The file-uploader was originally written by Jacob Gilley and I get the following error: Microsoft VBScript runtime error '800a0005' Invalid procedure call or argument cls-file-uploader.asp, line 139
0
3741
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 "System.ArgumentException" with explanation "The parameter is incorrect" when calling L2C_SendData_Issue(...) The function declaration in C#: L2C_SendData_Issue(object vau8BDAddr, object vu16LCID, ref object
0
3835
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 programmer, but this is my first .NET app... Original Code (what I have been doing and works) VB6 (extra stuff removed for clarity) Set objWbem = CreateObject("WbemScripting.SWbemLocator") Set objSvc = objWbem.ConnectServer(ComputerName, "root")
6
3870
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 there any way to do this with a variable length array? I've only been able to get it to work with a fixed size array. The relevant code snippets are below. Suggestions are greatly appreciated
0
9670
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9518
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10430
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10211
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10159
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9033
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4111
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3719
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.