interop

Weird occasional InvalidCastException in Excel interop

I am developing a fairly comprehensive Excel add-in, applying a lot of ops. Take a workbook, save under new name, apply actions (add names, change formulae, etc). Generally it works fine, but from time to time .Net throws an InvalidCastException on virtually any of my CTypes. When I acknowledge the error and run the code again (without ...

Interop directly with office graphing component from c#

I am working with a legacy application that uses the office graph.exe ( C:\Program Files\Microsoft Office\Office14\graph.exe ) I add a reference to the graph.exe component in my c# project and when I try to initialize the component I use: using Microsoft.Office; Interop.Graph.GlobalClass c = new .Interop.Graph.GlobalClass(); Interop....

Call CLR code from JVM

Is it possible to call CLR methods from JVM? Any library that would host a CLR instance inside JVM, and provide a simple mapping for Java? Are there any libraries that would do that? I'd like to write a plugin for existing Java application which already runs on JVM. I'd like to avoid having two binaries. I only want to call few methods...

Standalone version of MAPI and Redemption

What steps should i made for working with Redemption (need export to PST) on clear machine? Install Redemption.dll Install my app Install standalone version of MAPI What else i need to do? Now: session = new RDOSessionClass(); - work store = mSession.LogonPstStore(filePath, rdoStoreType.olStoreDefault, null, null, null); - throw e...

I'm getting the error "Application" is ambiguous in the namespace 'microsoft.office.interop.excel'

I have a project which opens a simple Excel file and populates it. It was working fine until this morning, when it has suddenly started giving me the error above: 'Application' is ambiguous in the namespace 'Microsoft.Office.Interop.Excel'. I haven't changed any project references, or anything within the file itself. The references incl...

passing an unmanaged function pointer callback to managed code using C++ interop

Hi all, I'm trying to add some managed code into an existing c++ GUI application. I'd like to get a functional callback working...specifically, I'd like to pass a method pointer from UNMANAGED code to MANAGED code and have the managed code invoke the callback. I'm looking at something like this: typedef int (__stdcall *ANSWERCB)(int)...

How to get rid COM context error

Hi, Am working on a windows form application which uses interop to call a COM dll. I keep getting this error in the app method where the flow is like this: 1.Fetch about 7 records[R] from database 2.For each of this record,app instantiates a COM class using Interop and does some processing/calculation using the same. 3.Then the app fet...

Best way to merge a git revision into a mercurial repository?

I have a git repository, which has changes that I am slowly bringing into a mercurial repository. (It's a weird history, and I'm hand checking everything, and just as well that I am). Currently, I've generating a diff using git diff, and merging it using patch. That had a few problems, so I switched hg import, which has problems of its ...

Java + OpenOffice, Is interop automation really this difficult?

Hi all, I'm trying to re-write a C# application of mine in Java. I've chosen Java because our target platform is now Linux, no longer Windows. My C# application used Microsoft Office Interop to automate things like Word and Excel. It would simply open different documents and apply our formatting to them (adjust column width, remove ita...

Extracting flash object from word doc through openxml using c#

Hi, I want to extract a flash object from a word doc using OpenXml.I have done it other way round but it is not working as, if there are many flash objects then the processing time got hampered and henceforth i think openxml is more suitable>please someone help me in doing the same .I am coding in c# ...

Generating interop wrapper classes throws error

When generating interop wrapper classes in visual studio 10 the tool throws the following error: Interopform wrapper class generator: Error creating interopForm Wrapper Classes for Project xxx Error list is empty where can I start to search for the source of the Error? ...

How to do excel interop on windows 2008?

Recently deployed my web app on Windows Server2008, IIS7 (with Office installed). After chasing (& catching) various other errors, I'm facing one I'm not sure even where to begin. On Cassini (visual studio dev server) everything worked flawlessly (reading excel through excel interop). On w2008 IIS it throws vague error: Value cann...

How can I get at unmanaged globals from C#?

I'm writing a .NET wrapper for an unmanaged DLL. The original DLL is C++ with a C shim that basically just replicates the API in C form, so that language bindings aren't such a pain. I've already written a Python binding for it, so I know what I'm trying to do should work. The DLL has a number of callbacks exported as global members, ...

How to export constant strings from .Net to COM?

I have a .NET DLL which I call from a VB6 project. Until now, I've had a public static class with a bunch of public const String STRING_NAME = "STRING VALUE"; When I needed to use one of them from VB6, I directly wrote inline the literal value in the code. Now I'd like to replace those literals with the .NET constants. I have t...

how to access primavera web services from .net?

Hi, I am trying to consume Primavera Web Services from .net application. While tring to access the Login method we are getting an error as below: Steps: Added the web reference in project. Created the object of the service. Then trying to access the method passing the parameters. "Unable to create message factory for SOAP: org.jbo...

Expose an enumeration from a wrapped COM component

I'm writing a class library in .NET that wraps a COM dll and exposes specific functionality to be consumed by other .NET code. The COM library has several enumerations defined and I've used some of the enum types as parameters like so: //C# public void TransactionTypeSetByEnum(COMComponent.TransactionType transType) { this.Transact...

Access "THIS_" COM parameter via C# ComImport

Most com methods have a signature like this: STDMETHOD(someFunc) (THIS_ ParamType param) PURE; Which translates to C# via ComImport as: [PreserveSig()] int someFunc(MarshaledParamType param); Is there some way to preserve the "THIS_" parameter in the PInvoke signature? So that I can do something like: int someFunc(IntPtr ptrToCOMI...

Debugging C# assembly launched by embedded mono runtime?

Hi! I am talking about a small game engine using C# for game programming. So, I have a C++ app embedding mono runtime (I call it 'launcher'). And I have an assembly written in C# which is my game engine class library. The launcher launches the assembly as it is suggested in Embedding Mono. And now the interesting part! The launcher impl...

Best way to clean up a COM object in a .net application

Hi, Am working on a .Net windows application which internally uses a COM dll. Out of the following 4 ways of releasing a COM object, which is the best one? 1. if (obj != null) { Marshal.ReleaseComObject(obj); } 2. if (obj != null) { Marshal.Relea...

Adding WPF window to Win32 application

I have a monster of a win32 application with GUI based on a mixture of MFC, WTL, user32 and a few other technologies. I need to add another top-level window and I would like to give WPF a chance. Could you help me identify the steps necessary to host a WPF window in win32 app? Details are welcome. ...