interop

Enterprise OSGi vs. EJB

Hello, i have an application server (JBoss) with some EJBs deployed. Now i must develop an OSGi application which i would like to reuse with my application server. I know that new application servers allows to deploy OSGi bundles in the application server itself. These are my questions: Could i simple deploy my OSGi bundles into the a...

How do I use the "Handles" clause from Visual Basic .NET with a DLL written using C#?

In a Visual Basic .NET application, is there a way to use Handles on an object referenced in a DLL written in C#? Compiling the code gives me the error: 'Handles' in modules must specify a 'WithEvents' variable qualified with a single identifier. I'm writing the Visual Basic .NET application, but I do have the source code of th...

COM to .NET Interoperability

If you want to use a COM type in your C# code, the process is straight forward, right? You just need to use the type library importer and that's fine, but what if you don't have one and you can't take a look at the IDL file? You just have the COM DLL server. As an example, try using the IActiveDesktop interface. What's the approch used...

How can I get the DOS path name of a running process in C# / Win32?

To sum it up, I need to do this: 12345(hWnd) -> "C:\setup.exe" Right now, I am using GetProcessImageFileName to retrieve the Kernel Device Path of a process handle. I'm retrieving the handle using OpenProcess, passing it the PID. The PID (which I also need) is being retrieved using GetWindowThreadProcessId. However, this gets ...

Is it possible to achieve binary compatibility in .NET library?

I have a .NET library visible in COM, and it's called from a vb6 application. If I add some methods and release a new version (but don't erase or change signatures of existing methods), I would like being able to just install it in the production machine, and have it working. However, it seems that such approach doesn't work; I need to ...

Direct3D COM interop in C#

Hello, I noticed that Direct3D is COM exposed, but there doesn't seem to be a type library for it. My first question is, what is the point of COM exposure if the infrastructure to use it isn't really there? I've considered that I could write my own COM interfaces in C#. But it makes me somewhat concerned that this hasn't already bee...

Call VB method in C# using Interop

Okey here's the situation: I've got a microsoft excel macro in vb that I want to call using C#. I've already tried creating a workbook using Microsoft.Office.Interop.Excel, however I don't want to have to run an excel process to run the macro. So then I thought why not make a vb class library with my code in it so i can still run it an...

File version vs. assembly version

I have a .NET (FW 2.0) library which is used by a COM (vb6) application and also by a .NET application. The TLB generated for COM is registered which a version consisting of the first two digits of the "assembly version". For example, 1.2.5.7 assembly version becomes version 1.2 of the TLB. This is very inconvenient, because sometimes ...

Using the COM Interop Excel object charts not getting copied when doing a Worksheet.Copy

I recently upgraded to Office 2010 and I am using the Microsoft.Office.Interop.Excel version 14.0 in a c# project. My code opens one workbook and copies a sheet into a second workbook. This was working fine in the previous version but now when it copies it is missing all of the chart objects. Anyone have any ideas? Here is my code: publ...

InvalidComObjectException when using Excel Interop

I get an InvalidComObjectException after I close my application in the following piece of code: class MyExcelManager { myExelAppInstance = new Excel.Application(); // finalizer ~MyExcelManager() { myExelAppInstance.Quit(); // InvalidComObjectException thrown here myExelAppInstance = null; } } Why is that? Shouldn't ...

How to pass a typed collection from clojure to java?

I know the basics of clojure/java interop: calling java from clojure and vice versa. However, I was not able to return a typed collection from clojure to java. I am trying to see something of that nature List<TypedObject> from the java code which is calling into clojure. Java Object: public class TypedObject { private OtherType1 _p...

Using interop to do a Word mailmerge using C#

I am trying to automate a mailmerge to print mailing labels with C#. I've created a Word template containing the label layout, but when I try to use interop to set the DataSource I am having issues. There are 2 ways I can go about this, either through accessing a SQL table or importing from an Excel spreadsheet. I've had mixed luck in...

WCF - Java web service interop - Signed outgoing message not accepted

Hi, I try to sign a message using a certificate and a private key to call a java (JBoss) web service, but the server refuses to accept my signed message. It only echoes back the same message that I've sent. I have successfully signed the outgoing message using the certificate, and the structure of the message look alright when I compar...

Getting COM exception when using Interop in a .net app

Hi, I've a C# class which uses a COM component using interop. Here is the sample code: public class MyClass { MyCOMClass myObj=null; try { myObj = new MyCOMClass(); for (int num = 0; num < myArr.Length; num++) { //Call a method on myObj and do some processing } } catch(Exception ex) { //log exception } finally { if (myObj != n...

How do I read the values of Excel dropdowns or checkboxes from c# or vb.net?

I'm using Microsoft.Office.Interop.Excel to read the values of cells of a worksheet, but I'm unable to find information that shows how to read dropdowns, checkboxes and option buttons. Thanks! ...

How do I integrate GEVA into Clojure

I am getting into Clojure and Grammatical Evolution at the same time and discovered GEVA, which is a GE tool written in Java. I have no background in Java. So I don't have to re-invent the wheel, how can I integrate GEVA into Clojure? I can execute the default script from the CLI with: java -jar GEVA.jar -main_class Main.Run The ...

C# wlanapi.dll issue receiving the signal strength

I am currently trying to retrieve the signal strength from a wireless access point using the wlanapi.dll WlanQueryInterface call. Here is my api declaration [DllImport("wlanapi.dll", SetLastError = true)] private static extern UInt32 WlanQueryInterface(IntPtr hClientHandle, ref Guid pInterfaceGuid, WLAN_INTF_OPCODE OpCode, IntPtr p...

Prevent Excel from quitting

Update: I still don't have a viable solution to this question, new proposals are welcome! I'm missing an Excel.Application.Quit or an Excel.Application.BeforeQuit event. Does anybody know a workaround to mimic these events? Given an Excel.Application object (COM Interop in C#), how can I: Preferrably prevent Excel from quitting? If t...

BadImageFormatException when using native DLLs from ASP.NET

Hi Iam referencing in my ASP.NET application a managed C++ project which makes use of a native dll named "libmmd.dll". If I run the ASP.NET application with visual studio I get an BadImageFormatException which tells me "The module was expected to contain an assembly manifest" (translated from german). What is the preferred way to includ...

COM interop question

Am using COM interop in my C# application. I've this line of code: IMyInterface objData = MyCOMClass.GetData(); My question here is: Do I need to release resources on objData by using? System.Runtime.InteropServices.Marshal.ReleaseComObject(objData); Thanks for reading. ...