interop

Why use FinalReleaseComObject instead of ReleaseComObject?

I know the basic difference as ReleaseComObject only decreases some counter by one and FinalReleaseComObject decreases it to zero. So what I usually hear is, call FinalReleaseComObject because then you are sure that the COM object is really released. But this makes me wonder, there is a point to this counter right? Aren't you breakin...

C# generated proxy method different than original Java service method

Hi, I have a Java service that has the following method signature: @WebMethod(operationName = "getContactList") public MyListClass getContactList(@WebParam(name = "myList") MyListClass myList) throws IllegalArgumentException { return myList; } public class MyListClass implements Serializable{ Lis...

Signed assembly dependency that references a COM DLL must have the dependency's generated interop assembly referenced

Sorry about the terrible title. I have a signed assembly 'Signed.dll' that is a dependency of another assembly, say Executable.exe. Signed.dll references a COM DLL and publically exposes one of this COM DLL's types: 'ComPublicT.' Executable.exe must reference the automatically generated Interop.COM.dll from the Signed project, rather ...

How can I get VS 2008 to use Interop.DTS in place of old COM DTS?

I have a VS 2008 project that is using DTS. The project is in source control, and I don't want to check out and modify the project references for fear of stubbing the toes of other developers for whom things are just fine. For me, right now Visual Studio can't locate the DTS reference used by the project. I have SQL Server 2008 instal...

Excel Com Interop ASP.Net Cannot write file to disk. Permissions?

I've got a pretty simple web form which lets users pick reports, one specific report they want in xls with pretty formatting instead of CSV. I've whipped up the report using COM INTEROP with excel 2007. It works on my local machine and can write the file, but on the web server it fails with this error: Microsoft Office Excel cannot op...

How can I send input to Visual Studio using Windows API

Hello, I am trying to develop a util (using system-hook) for that works like an expander (user selects some text and presses a hotkey and it is expands). It should work with Visual Studio. I want to implement this using Windows API because I want to develop an app that works globally with any application (whether you're using VS, or wo...

Interop assembly pointer length

Why does Visual Studio sometimes turn SAME pointer parameters in COM libraries into uint and sometimes to ulong? I have a COM library that has some methods with parameters such as [ in ] ULONG_PTR ParentWindow When I reference this library on my desktop computer, the interop assembly turns the ULONG_PTR into uint. When I do the same o...

Interoperability by using Spring and Hessian ? Is it possible ?

Hi, Spring in Action book says: Hessian, like RMI, uses binary messages to communicate between client and service. However, unlike other binary remoting technologies (such as RMI), the binary message IS PORTABLE to languages other than Java, including PHP, Python, C++, and C#. (316) Can you give me some advice how can i get it ? T...

Transparent background for MFC-hosted Windows Forms UserControl

I am using CWinFormsControl to host a Windows Forms UserControl in an MFC dialog. I have set the property DoubleBufferd to true. According to the docs this results in AllPaintingInWmPaint and UserPaint to be set to true too (not sure if this matters). How can I force (or fake) the UserControl to draw its background transparent? This is ...

COM - .NET Interop - Winform from COM client

hi there, I have a .NET application containing a WinForm. This WinForm contains an unmanaged ActiveX control and a few other controls. This application works fine in standalone mode. Now we want to publish some kind of interface so this Winform can be used from unmanaged C++/MFC applications using Interop functionality. The client appli...

Using DLLImport with an output char[] containing null characters

I am writing a c# app using .NET 2.0. I need to use an old library for proprietary compression. I don't have source code for the library, and the developers behind it are long gone. My problem is that the resulting char[] contains nulls, and is being truncated. Here is the declaration for the function: [DLLImport("foo.dll")] public sta...

C function in VB.NET

I'm having some problems calling a C function from a DLL, and was hoping someone could help me out. The function is returning -101 which translates as a "bad parameter". The values I am passing have been returned from another, successful function call, so my current assumption is that I've built the structure incorrectly. Any help is ...

Error while generating a PDF file with Excel in ASP.NET

I have to generate an excel file and a PDF file from an asp.net application. I'm using the Interop assemblies and I can generate the excel file without any problem. But when I'm generating an pdf file with the add-in SaveAsPDFandXPS.exe I'm getting the next error: Exception HRESULT: 0x800A03EC with a debug I see the error is in the...

How to determine which DLL an Excel UDF is coming from ?

Hello, is there any way to determine from an Excel session, which DLL an UDF is coming from ? I have a bunch of DLLs loaded by default, I wanted to determine for every UDF where it was defined. If the UDF was not defined in a DLL but via VBA, is there a way to determine in which XLA or XLS it was defined ? Thanks very much for taking...

Add offset to IntPtr

Hello, I'm looking for a way to perform pointer operations in C# or .NET in particular. I want to do something very simple Having a pointer IntPtr I want to get IntPtr object which points to 2 bytes ahead. I read some post that the foolowing snippet will work... IntPtr ptr = new IntPtr(oldptr.ToInt32() + 2); But I have doubts whet...

COM Interop in .NET

I have a C# Visual Studio 2008 project and I want use a COM interop XXXXLib (XXXX.dll). Of course I have to add reference to %windir%\system32\xxxx.dll before, and VS will add Interop.xxxx.dll to the project folder, and now I have to distribute this 200 KB library with my simple 4 KB application. But, now I know that PCs don't have XXX...

How can I debug a crash-on-exit of a .NET add-in to a native application?

I've got a .NET plugin (written in C# & VB.NET) exposed via COM and loaded into an application built using native code (C++). We're working on a 64 bit compatibility release, and when the application exits we're seeing a crash screen from the application. If I run the application from a Visual Studio debug session the crash isn't cau...

Accessing Excel.ComboBox from C#

Hi, I have a combobox (the drop down list control) in a pre-existing Excel template. I can reference this combobox in VBA with Sheet10.ComboBox1. How can I reference this through Excel Interop in C#? What I am trying to do is populate this combobox/dropdown with C# and have it positioned where I want with the template. Thanks in adv...

Why does excel remain open?

Hello all, I've this function that I use to calculate the linear trend of some data: private string Trend(object conocido_y, object conocido_x, object nueva_matriz_x) { string result = String.Empty; try { Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application(); result =...

Best method of calling managed code(c#) from unmanaged C++

Hello, We have developed a s/w architecture consisting of set of objects developed in C#. They make extensive use of events to notify the client of changes in status, etc. The intention originally was to allow legacy code to use these managed objects through COM interop services. That was easy to write in the design specification b...