interop

PowerPoint version compilation

Let's say I am using SharpDevelop/VS to develop an app that uses PowerPoint. Do I need to recompile the app so there is a build for each version of MS Office? I have MS Office 2007, but I would also like the app to work with Office 2003 and later, without having to recompile the app for each version. Do I just need to install the appr...

C++ DLL Called From C# on Windows CE for ARM Always Returns 0

I am currently developing an application for Windows CE on the TI OMAP processor, which is an ARM processor. I am trying to simply call a function in a C++ DLL file from C# and I always get a value of 0 back, no matter which data type I use. Is this most likely some kind of calling convention mismatch? I am compiling the DLL and the m...

How to set output audio device for a movie in QuickTime SDK in C# when function isn't exposed in Interop assembly?

I'm using the latest version of the QuickTime SDK and want to have the audio from the "movies" (they are referenced as movies but can be mp3, m4a, mov, and other filetypes) played through specific audio devices if the user has more than one audio device. Apple has a couple functions in one of their samples that allow you to do this but ...

Scala - Java interop: can Scala emit enums in bytecode for Java to consume?

I have a project that is mixed Java/Scala, it is Java GUI code that makes use of a Scala library. Is there a way to write Scala code such that it will emit Java enums on compile time? The approaches I tried so far (sealed case classes, extend Enumeration) seem to generate normal classes which makes working with them from Java much hairie...

How do I use c# to re-implement an old DCOM server without breaking existing clients?

Back in the day, I wrote an out-of-process (i.e. EXE) COM server using VC++ 7.x (Visual Studio 2003 and .Net 1.1) using the ATL library. The server used the Multi Threaded Apartment (MTA) model and is activated by DCOM calls (VB6 clients). Multiple client requests are satisfied by a single process -- which is activated by the first req...

connecting managed event source to an unmanaged event sink

I'm trying to write a managed library in C# that will act as an event source for an existing C++ event sink. The problem I'm having is that when the unmanaged app calls AtlAdvise to get the connection point map for my library it is getting the error "0x80040200" (CONNECT_E_NOCONNECTION) - There are a couple of MSDN articles about that er...

appdomains in COM interop

I have a .Net class that calls a c++ COM object which in turn calls another .Net class in COM. I've found that the two .Net classes are in seperate appdomains (which makes some trouble with log4net). Note they are in the same thread though. Why is this? Is there a way to ensure they will be in the same appdomain? ...

How do I inteface OCaml with iPhone API?

I'd like to start developing applications for iPhone, but I'd really like to use OCaml rather than Objective-C. After some googling, it seems like this is definitely possible, but I haven't found any code snippets which actually compile. Is it possible to write iPhone apps using OCaml? If so, could you provide a snippet demonstrating ho...

How do you access an already running COM object using .NET Interop?

I have an application that has its own database as a COM component. I need to write an application that links into an already running instance for this COM database using C# so that I can tweek the values in the database and see how they effect the application. In the past I have written similar applications using Monikers. Is there a...

SetText of textbox in external app. Win32 API

Using Winspector I've found out the ID of the child textbox I want to change is 114. Why isn't this code changing the text of the TextBox? [DllImport("user32.dll")] static extern IntPtr GetDlgItem(IntPtr hDlg, int nIDDlgItem); [DllImport("user32.dll")] public static extern int SendMessage(IntPtr hWnd, int msg, int Param,...

C# - NetUseAdd from NetApi32.dll on Windows Server 2008 and IIS7

I am attemping to use NetUseAdd to add a share that is needed by an application. My code looks like this. [DllImport("NetApi32.dll", SetLastError = true, CharSet = CharSet.Unicode)] internal static extern uint NetUseAdd( string UncServerName, uint Level, IntPtr Buf, out uint ParmError); ... USE_INFO_2 info = new U...

Unmanaged code calling vb.net callback

I am upgrading vb.net app that handles the events of a COM object (possibly written in VB6) from framework 1.1 to WPF 2.0/3.5 The code: (object names simplified for brevity) public class MyClass Private WithEvents serviceMonitor As COMOBJECT.ServiceMonitor Public Sub New() serviceMonitor = New COMOBJECT.ServiceMonitor()...

How can I import an interop dll into actionscript

Making an adobe flex ui in which data that is calculated must use proprietary functions from a dll. How can I import this dll into actionscript? Is this the only way to achieve my goal? Thanks! ...

Pinvoke problem with the Windows helper API

This is my first serious attempt at P/invoke. This is a console app I'm using to work out the code for a web service that will hopefully return a mac address from an ip address or fully qualified system name. The code compiles. However when run without args, I get an unhandled exception-IndexOutOfRangeException. If I run it with args, I ...

COM interop object throws InvalidCastException in one project but not in other

I have a COM object I imported in my test C# solution. Everything works fine and continues to do so. Then I imported the same COM object in my actual solution and as a test implemented the exact same lines as in the test project. When I run the real project I get an InvalidCastException Unable to cast COM object of type 'CTWebReport.We...

C# and Excel interop

Hey guys. One of my users is having an issue when trying to open an Excel file through my C# app. Everything works ok when I run it from my machine and it works for other users. I am no Excel interop expert so hopefully you guys can help me out. Here is how it is setup: I added a reference to my app to Microsoft.Office.Interop.Excel....

Loading Native DLL as Debug Module in Managed C# Code for Windows CE

I am writing a Windows CE application in C# that references a native C++ DLL (that I am also coding) using the following method: [DllImport("CImg_IP_CE.dll")] public static unsafe extern void doBlur(byte* imgData, int sigma); This actually works fine but I am unable to debug the DLL. When I check the debug modules that are load...

ASP.NET app hangs when accessing ActiveX component

We use MapInfo MapX mapping engine in our ASP.NET application. After server (Windows Server 2003 SP2) reinstallation we encountered a strange problem - web app hangs when accessing ActiveX instance. For example: MapXLib.Map _mapXMap = (MapXLib.Map)HttpContext.Current.Server.CreateObject("MapX.Map.5"); _mapXMap.MapUnit = MapXLib.M...

MapPoint GetPictureFromObject method

According to the msdn documentation: GetPictureFromObject method Returns a picture (Visual Basic Picture object) of the current map view. After digging around, I found that this "Picture" object apparently hasn't existed since VB6. I guess there's no way to write a class to masquerade as this type... Or is there? ...

VirtualBox COM API from C#

I am trying to use the VirtualBox COM API (VBoxC.dll) from C#. I ran tlbimp VirtualBox.tlb against the typelib included in the VirtualBox SDK. Referencing the output assembly builds OK but at runtime I get a SafeArrayTypeMispatchException ("Specificed array was not of the expected type") whenever I try to access properties that retur...