473,799 Members | 3,114 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Com Variant Marshalling Question

Bob
I have been trying to us an unmanaged dll for a while now with no good
results. Most of the dll methods i can use and have been. I however
have a problem with this one. I am supposed to ref 15 objects as the
following type.

This is one of the 15 variables i am using.

[MarshalAs(Unman agedType.SafeAr ray | UnmanagedType.I 4)]
object secondaryFieldS coreDataSA = new int [8];

private myMethod()
{
int i = failedMethod(re f secondaryFieldS coreDataSA,ref ...);
...............
}

I keep getting an invalid param used. I have contacted the company
that created the dll and they had me try using the .SafeArray | I4 and
it still doesn't work. I have tried almost everything. I am missing
something. I visual studio it is asking for 15 ref objects and in the
documentation from the vendor it should be returned as an array of
type long items. Any help is greatly appreciated.
Need Help,
Bob;
Nov 13 '05 #1
0 1960

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
7268
by: C. N. Sridhar | last post by:
Hi, I'm writing a wrapper to a win32 dll in C#. I need to call a method in DLL which has a Variant type reference parameter. How to marshal variant type from win32 (unmanaged code) to C# (managed code)? I tried using Marshal.GetObjectForNativeVariant(), but of no use.
3
2841
by: PHil Coveney | last post by:
Hello, I am having difficulty marshalling structures when calling DeviceIoControl. I am importing this Win32 function as static extern int DeviceIoControl (int hDevice, int dwIoControlCode, ref int lpInBuffer,
2
3222
by: Dave | last post by:
I wish to call a COM Object which has a parameter of type VARIANT* on a method call from C# The COM Method :- STDMETHODIMP CClassType::GetTypeIDs(VARIANT * TypeIDs) { AFX_MANAGE_STATE(AfxGetStaticModuleState()) if (DeviceTypeIDs->vt != (VT_I2|VT_ARRAY)) return E_INVALIDARG ; VARIANT* ptr ;
1
1104
by: MuZZy | last post by:
Hello, I am probably facing a sort of language barrier, but i can't really get what 'marshalling' is in terms of .NET Is it a kind of type casting? And when do you use it? Thank you, Andrey
2
5790
by: Rookie | last post by:
Hi, I had a question on DllImport. On importing a function from a VC++ dll using DllImport (to a C# program), the function argument data types and the return types may be of a type that is not supported by C#. In this case if I am not mistaken the system performs default marshalling - matching the data types to its most similar equivalent in C#. Is this right? Also, I presume this can be overridden by using MarshalAs. Is this
0
1913
by: Andrew S. Giles | last post by:
Helo all, I have a standalone unmanaged C++ application that makes a call on another standalone COM server, which raises an event that should be handled in C#. I am trying to send: unsigned long, double, BSTR, and VARIANT. The unsigned long, double, and BSTR (marshalled to System.String) work just fine and dandy.
2
1290
by: BartMan | last post by:
Greetings, When working with managed c++, do you have to do anything special when going from simple types from managed to unmanaged and vice versa. Or is marshalling handled automatically for you? I have seen from several posts that you have to do special conversions for strings, but what about the other types such as int, long,ect. In my case I want to save it as a member variable from a managed class into an unmanaged class's.
1
276
by: GianPiero Andreis | last post by:
Hello All, let me pose a simple question about combobox and the CB_INSERTSTRING message. Suppose for instance that I already have a combobox handle, how can I declare and use the SendMessage function just for insert a new item into the combobox ? Of course, the combo box DO NOT belong to my process, so I can't use the standard properties of that class. In fact, I need to "put" a new entry in the combo box of IExplorer. EnumWindows get...
0
1241
by: WTH | last post by:
....and you get safe array type mismatch exceptions from the marshaller. I have a C++ COM object (thank God I could find the source) that was declared properly in the IDL for and requiring a VARIANT*, everytime I tried to use this object from C# the marshaller would throw up marshalling the return value. Now, I should mention that this COM object works great in when used by C++ code which has to marshall the data as well. I googled...
2
3353
by: calenlas | last post by:
Hi all, I'm taking my first steps into C# <--C++ DLL Interop and unfortunately I've run into (what seems to be) a very complicated case as my first task. Perhaps someone here can help me. I need to pass an array of RADIO_INFO2 structures to be filled by a function in the DLL. This is how the structure is defined in the C++ example that comes with the DLL:
0
9538
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
10470
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...
1
10214
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
9067
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...
1
7561
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6803
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5583
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3751
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2935
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.