interop

How to connect .Net app to JMX agent?

I need to connect my .Net application to somebody else's JMX agent. I've read that this is simply not the done thing and I should use soap or practically anything else. As this is just not going to happen, are there any libraries or interop techniques out there that can help me? I'm only interested in the simple things like invoking a re...

Does C# clean up C++ allocated memory?

I have a hypothetical COM object with the following signature void MemAlloc(ref double[] test, int membercount) where the memory is allocated in C++ using new/malloc. Once this is in C#, using the RCW, how do I ensure that the memory is freed correctly? I would think it would be difficult for .NET to free, considering in C++ you need ...

Why isn't my IE MIME filter being created or called?

I'm trying to create a MIME filter to do some custom processing of resources received with web pages before passing them to the web browser control in our Windows application. The application is written in C#, and I'd like to write the MIME filter in managed code as well, if possible. I'm having trouble with it though: my filter object...

How can I get C# to interop with Javascript?

I'd like to host Javascript in my C# program. I would like to allow users to write custom Javascript code, and have my C# program run their functions, as well as allow the users to use my framework code. Is it possible to do this? If so, how? Edit: To be clear, I am not using ASP.NET for this project. ...

Interop sending string from C# to C++

Duplicate of http://stackoverflow.com/questions/683013/interop-sending-string-from-c-to-c I want to send a string from C# to a function in a native C++ DLL. Here is my code: The C# side: [DllImport(@"Native3DHandler.dll", EntryPoint = "#22", CharSet = CharSet.Unicode)] private static extern void func1(string str); public void func2(...

Getting an IntPtr to a ulong variable in C#

I need to pass an IntPtr to IStream.Read, and the IntPtr should point to a ulong variable. How do I get this IntPtr that points to my ulong variable? ...

Can't get SAFEARRAY to work with Interop

I have an ATL COM Server, where the method for the interface is STDMETHODIMP CWrapper::RUN(long iDataSize, SAFEARRAY** iData) and the MIDL for this function looks like [id(1), helpstring("method RUN")] HRESULT RUN([in] long nSize, [in, size_is(nSize)] SAFEARRAY(_MyDataType*)* iData); I import the tlb from this project using tlbimp...

COM Interop IDictionary - How to retrieve a value in C#?

using: VS2008, C# I have a COM dll I need to use in a .NET project. In there I have a class with a method that returns an IDictionary object. IDictionary is defined in the COM dll so I'm not sure if it's the same as IDictionary in .NET. My problem: I know the dictionary keys and I want to retrieve the values. The documentation for this...

Problem in calling a C++ dll function from C#

Hello, This is my 3rd thread concerning a blowfish problem in C#.Despite the fact I cannot have blowfish implemented in my application, I decided to use it as an external C++ dll. Please note I've tried Blowfish.NET and any other, the problem is that I'm translating code from C++ to C# and the C# code must do exactly the same as the C++...

How determine the PID of a process that was started by instantiating a COM coclass?

Is there any way to determine the PID of a process that was started by instantiating a COM coclass? For example: MyApp.ApplicationClass anApp = new MyApp.ApplicationClass(); would start the process myapp. Potentially there are already a lot of myapp processes running when this code is executed. My current solution to acquire the la...

Com Interop w/ MSXML

I'm trying to COM interop w/ Navision through a .Net assembly - and specifically using MSXML interfaces. This leads to the following error message: The assembly "C:\Users\bra\Documents\Visual Studio 2008\Projects\SOAPROXY\SOAPROXY\bin\Release\SOAPROXY.dll" could not be converted to a type library. Type library exporter encountered an er...

Will upgrading Office from 2003 to 2007 break VB programs which use Excel through the COM interop?

Assume all traces of Office 2003 will be removed from the computer. UPDATE: I understand that I will still be able to use .xls files. I'm asking about automating Excel through the COM interop from outside Excel. When I add a reference to Excel to a VB project, it gives me a different version of the dll for different versions of Excel. ...

MS Access interop - Data Import

I am working on a exe to export SQL to Access, we do not want to use DTS as we have multiple clients each exporting different views and the overhead to setup and maintain the DTS packages is too much. *Edit: This process is automated for many clients every night, so the whole process has to be kicked off and controlled within a cursor i...

WinMM Library Issues

I wrote a WinMM library wrapper library that exposes WaveOut and WaveIn classes for the purpose of recording and playing raw audio streams. Everything works great, but in order to follow the operating system specs on how to handle the finished buffers, I added a thread that unprepares the buffers and frees the memory. I also got all of...

Compromised interoperability in .NET?

Recently I asked a question here about using F# extensions in C#. Brian quoted: Per the language spec, section 10.7 "Type extensions": Optional extension members are syntactic sugar for static members. Uses of optional extension members elaborate to calls to static members with encoded names where the object is passed as the fir...

Bitmap editing in unsafe context - how to avoid instability?

I'm trying to use a bitmap in an unsafe context, and am seeing instability in that, e.g., the program runs the first time round but fails the second. Here is the code: private static void RenderBitmap(Graphics g) { const int width = 150, height = 150; using (Bitmap bmp = new Bitmap(width, height, System.Drawing.Imaging.PixelFor...

run the output of a script as a standalone bash command

suppose you have a perl script "foobar.pl" that prints the following to stdout date -R and you want to run whatever that perl script outputs as a standalone bash command (don't worry about security problems as this is running in a trusted environment). How do you get bash to recognize this as a standalone command? I've tried using x...

Calling methods on interop objects, VB vs. C#.

In C# I'm calling a function on an interop class (Connection, written in VB6), which itself returns a plain object (System). Then there's a function on that object (InitialiseData) that I also call (even though the compiler isn't aware of it). var isInitialised = Connection.System.InitialiseData(path); The problem is, because that Sys...

BadImageFormatException encountered with WcfSvcHost and IIS WCF host

Creating a WCF Service Library in Visual Studio 2008 on Vista x64 is troublesome when referencing an x86 DLL. A service that calls a 32-bit DLL is required to have a platform target of x86 to run on a 64-bit OS. When you do this, the WcfSvcHost throws a BadImageFormatException when you attempt to debug the service. There is a bug report ...

Making a C# kill event for a vb6 app?

I have a VB6 app that processes for a very, very long time. Killing it directly is not feasible, so I would like to set some sort of flag in the VB6 app. If in my C# app I decide to shut it down, I would like to toggle this flag to let the VB6 app know that a shutdown has been requested. Now, I also need something that is named because t...