interop

Pass C# string to C++ and pass C++ result (string, char*.. whatever) to C#

I tried different things but i'm getting mad with Interop. (here the word string is not referred to a variabile type but "a collection of char"): I have an unmanaged C++ function, defined in a dll, that i'm trying to access from C#, this function has a string parameter and a string return value like this: string myFunction(string input...

How do i get a System.Windows.Window

I want to use global hotkeys (one that works outside of the app) and i found this It looks like i need to initialize it using a System.Windows.Window. But how do i get one? ...

Updating External system from excel

It's obviously possible from a demo i saw earlier but didn't catch enough details I envision making a function call such as =MyRTDReverse("keyvalue", "fieldName", [AC51]) or =MyRTDReverse("keyvalue", [AB51], [AC51]) // where AB51 has the field name and AC51 has the field value etc. where updating the value in cell AC51 triggers...

Releasing temporary COM objects

Consider the following C# code using a COM object. MyComObject o = new MyComObject; try { try { var baz = o.Foo.Bar.Baz; // do something with baz } finally { Marshal.ReleaseComObject(baz); } } finally { Marshal.ReleaseComObject(o); } This will release the COM objects o and baz, but not the temporary objects returnd by...

Excel get_Range missing when interop assembly is embedded in .NET 4.0

I build an assembly referencing a COM interop DLL. If I embed the COM interop types by setting Embed Interop Types to True in the Reference's properties (VS2010), at run-time an error occurs "object does not contain a definition for get_Range". If COM interop types are not embedded then no error occurs. Does anyone know why a particul...

Unmanaged Exports / Robert Giesecke

In the following answer Robert Giesecke describes a way to export managed code to native applications without the need of COM registration: Answer on stackoverflow from Robert Giesecke I downloaded the UnmanagedExportLibrary.zip from and built the samples using Visual C# 2008 Express Edition for the .net part and delphi 2010 for the w...

Java Applet consuming client-side dotnet framework redistributable

I need to access and use some image manipulation api's other than java's, so is it possible to access the windows .net redistributable api's from a java applet that is signed. ...

Getting "System.Runtime.InteropServices.COMException was unhandled" message during programmatically modifying the msi

I have project in C# to modify the contents of an msi programmatically. Sometimes(I suspect when the size of the msi exceeds 10 MB) during the updation i am getting Interop Runtime exception which is as following. System.Runtime.InteropServices.COMException was unhandled HelpLink="Msi.chm#9502" Message="SummaryInformation,UpdateCoun...

What is the most annoying / strangest thing that has happened to you using Excel Interop

Hi All, After developing using the Excel Interop with .Net for a while, i have become increasingly annoyed with the how many "odd things" happen - such as this question i posted earlier - My Problem. I appreciate that this is not a direct question and more of a collaberation of experiences, but i do think that it would be helpful how...

CreateObject equivalent in C/C++? (COM Interop)

What would the equivalent in C/C++? ...

TYPE_E_CANTLOADLIBRARY when using a COM object on a separate thread on Windows 2003 x64 only

Hi all, I have a Windows Forms app (compiled as x86) accessing a COM object. It gives me the following error, only on Windows 2003 x64, when the code is run on a separate thread: Exception during creation of IDoc:Unable to cast COM object of type 'PTISG.COM.TeklogixQueue.QueueClass' to interface type 'PTISG.COM.TeklogixQueue._Queue'. ...

How to write the C# prototype to P/Invoke a function which takes a char* as an argument, and returns its value there.

As the title suggests, I'm trying to write some C# code to interop with a C DLL (It's a Windows device driver, basically). The error code function signature in C is: UINT DLLErrorMsg( DWORD errorCode, char * pBuf, UINT nSize ); nSize is the size of pBuf. If nSize can fit the error message, it is copied into pBuf and 0 returned, othe...

need help custom marshaling..??

Hi, i need help about custom marshaling..i have a native DLL..the parameters of the some DLL functions is defined with unsigned char* for example; typedef short apiStatus; apiStatus __declspec(dllexport) __stdcall DrfGetFirmwareVersion (HANDLE hCom, unsigned char *major,unsigned char *minor, unsigned char ReaderAddr = 0xff); t...

How can use Ado. Net from Delphi Win32

Is possible to use ADO .Net from an Win32 Application build with Delphi 7. maybe using CrossTalk or Hydra? Any recommendation is welcome. thanks in advance. ...

Using java library from .NET

What is the best way to use java library from .NET? ...

Implementing Communication Between JavaScript Code and Console Application C#

Now I'm solving web server performance testing task and a have a little problem. There is a way to communication between DHTML and C# code. It works perfectly in Win Application but I need Console Application. So I create simple test Program.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; nam...

IExtractImage works from a console application but not a plug-in?

I'm writing a program that needs to be able to extract the thumbnail image from a file. I've gotten a hold of a class, ThumbnailCreator, which is able to do this. The source of this Class is below. using System; using System.Drawing; using System.Runtime.InteropServices; using System.Text; using System.IO; using System.Drawing.Imaging; ...

Getting to Microsoft.Office.Interop.Word.dll?

When FxCop examines an assembly it gives the following error: The following reference assembly could not be found. The assembly is required for analysis and was referenced by Test.dll. Microsoft.Office.Interop.Word, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c So, I did a search and found the file in: C:\Windo...

Can/how do you host a full VB6 Form in a C# WPF app?

I am currently exploring the option of porting some older VB6 application to WPF with C#. The plan, in phase one, is to port several key forms and not all the application. The theoretical goal is to open the VB6 form in a container of some sort within WPF via an ActiveX dll. Is this even possible? I've tried looking at the Interop and c...

COMException in C# when hooking into event...

I am receiving a COM Exception when trying to hook into an event on a COM Object. Here is the code I am trying to execute. COMClass a = IComClass as ComClass; a.SomeEvent += new SomeEvent_EventHandler(MethodNameHere); Line two throws an exception of type COMException with the following information: System.Runtime.InteropServices.C...