interop

DLLImport Int** - How to do this if it can be done.

I am trying to use a third party DLL that wants an int** as one of the parameters to the method. It describes the parameter as the address of the pointer that will point to the memory allocation. Sorry for any confusion. The parameter is two-way I think. The DLL is for talking to an FPGA board and the method is setting up DMA transfe...

How do you pass an array of string through an event in an Interop User Control to vb6

I have a VB.net control that has an event: Public Event PassNames(ByVal names() as String) When the event triggered in VB6, I get the following error: "Function or interface marked as restriced, or the function uses an Automation type not supported in Visual Basic" Here is the event in VB6: Private Sub IteropControl1_PassNames(ByV...

C# invoking CPP function with unknown number of args from CPP

i have a function in CPP with the following prototype: char* complexFunction(char* arg1, ...); i import it from a C# using DLLImport attribute. the questions are: how do i define the prototype in the C# (under the DLLImport attribute)? how do i pass the arguments to this function? thanks ...

Can OpenLaszlo apps access AIR APIs?

It seems OpenLaszlo can run on AIR. What's less obvious is whether OpenLaszlo apps can use the AIR-specific APIs, like file system access. If so, how exactly is this done? ...

How can I save a very large MATLAB sparse matrix to a text file?

I have a 30000x14000 sparse matrix in MATLAB, which I need to use in another program. Calling save won't write this as ASCII (not supported). Calling full() on this monster results in an Out of Memory error. How do I export it? I use MATLAB 7. ...

Internet Explorer Toolbar Tab Key

I've written a IE Toolbar in C# and everything is working fine except that when I open a child Windows Form from my toolbar, the tab key doesn't work on the child form to allow me to move from field to field. The interesting part is that when I open my child form using form.showDialog() instead of form.show() the tabs work like normal....

.NET COM Interop Method Signature

What interop signature would you use for the following COM method? I am interested particularly in the final two parameters, and whether to try to use MarshalAs with a SizeParamIndex or not. HRESULT GetOutputSetting( DWORD dwOutputNum, LPCWSTR pszName, WMT_ATTR_DATATYPE* pType, BYTE* pValue, WORD* pcbLength ); Doc...

.NET - Microsoft.Office.Interop.Excel and Interop.Excel DLL

Hi, When I add a reference to Microsoft.Office.Interop.Excel on my computer, Visual Studio adds this to the project file: <COMReference Include="Excel"> <Guid>{00020813-0000-0000-C000-000000000046}</Guid> <VersionMajor>1</VersionMajor> <VersionMinor>5</VersionMinor> <Lcid>0</Lcid> <WrapperTool>primary</WrapperTool> <Isolate...

Thread local storage with __declspec(thread) fails in C++/CLI

I'm working on a project where we mix .NET code and native C++ code via a C++/CLI layer. In this solution I want to use Thread Local Storage via the __declspec(thread) declaration: __declspec(thread) int lastId = 0; However, at the first access of the variable, I get a NullReferenceException. To be more precise, the declaration is don...

calling managed code from unmanaged code

Hi, I want to call my .NET code from unmanaged C++. My process entrypoint is .NET based, so I don't have to worry about hosting the CLR. I know it can be done using COM wrappers for .NET objects, but I would like to access individual static methods of managed classes, so COM isn't my shortest/easiest route. Thanks! ...

CUDA for .net?

I know that there are a lot of CUDA language bindings, such as PyCUDA, but are there any good bindings for .Net? The only one I've seen is this one, but I'd like to know if there are any others. ...

Protected Memory Violation calling FORTRAN DLL from C#

I am trying to call out to a legacy dll compiled from FORTRAN code. I am new to Interop, but I've read some articles on it and it seems like my case should be fairly straightforward. The method I really want to call has a complex method signature, but I can't even call this simple GetVersion method without getting a protected memory ...

What is the actual function of the C# project setting "Allow unsafe code"

I was wondering if the C# project setting "Allow unsafe code" applies only to unsafe C# code in the project itself, or is it necessary to set this option when linking in a native C++ DLL? What about linking in a managed DLL that itself links to a native DLL? What does this option really do, under the hood? ...

Programmatically Printing in Adobe Reader 9 using .NET Interop

I am using VB.Net WinForms. I would like to call the Adobe Reader 9 ActiveX control to print some PDFs. I have added the ActiveX control to the VS toolbox (the dll is AcroPDF.dll, the COM name "Adobe PDF Reader". After some experiment the following code works. Dim files As String() = Directory.GetFiles(TextBoxPath.Text, "*.pdf", Sear...

SQL CE 3.5 deployment problem, concerning interop between C# and C++

Hi! We have a situation where a C# application is working with SQL CE 3.5 . To allow for a legacy program to use some of its features we have produced a C++ dll which uses interop to extract the info that it needs from the C# program. For this to work, the C#-program needs to access the database. Its not a very complex scenario. When t...

Vista, Office Interop not working

Does anyone know how to get the MS Office 2007 .NET C# Interop libraries to work with Vista? I have a .NET C# application that I have setup to run as a Windows service. This program will open up a Word or Excel template depending on the situation and modify its contents and then save the document back out. All of this worked great ...

Does COM interop respect .NET AppDomain boundaries for assembly loading?

Here's the core problem: I have a .NET application that is using COM interop in a separate AppDomain. The COM stuff seems to be loading assemblies back into the default domain, rather than the AppDomain from which the COM stuff is being called. What I want to know is: is this expected behaviour, or am I doing something wrong to cause th...

.NET Interop: Using an assembly in the current directory

I'm trying to use a .NET assembly from VB6 via interop without placing it in the GAC and without using the /codebase argument for regasm.exe. From what I understand, when I run regasm.exe on a .NET class library, it creates a registry entry for each class in the class library telling the COM clients they should load mscoree.dll that ser...

How to use an app.config file when calling a C# dll from C++

How do I use an app.config file for the .Net part when calling a .Net dll from C++ and the data in the config-file must be read at the .Net runtime startup. If I use have a foo.dll.config that I call from ConfigurationManager.OpenExeConfiguration("foo.dll") I can access application settings. What I would like to do though is to change s...

Load COM oject from jsp

Hi, I am developing a jsp application. I am forced to load a COM object. Can such a thing can be done? if yes, how?? Many thanks, Ofer ...