interop

[F#] Nullable values do not get modified when passed into C# code by reference.

I have an F# variable defined as follows let id = new Nullable<int>() and I am passing it from F# into a C# function that takes a ref Nullable<int> and, subsequently, assigns it a value (it's basically stored procedure code auto-generated by Linq2Sql). Unfortunately, when the function call exits, my id variable still has no value (i....

raising a vb6 event using interop

Hi, I have a legacy VB6 component that I've imported into VS using tlbimp.exe to generate my interop assembly. The VB6 component defines an event that allows me to pass messages within VB6. Public Event Message(ByVal iMsg As Variant, oCancel As Variant) I would really like to be able to raise this even in my C# program, but its gettin...

Using a C++ header with .NET language

I trying to use a ".h" file from Windows SDK in a .NET language (maybe C#), but without success. This header exposes some Windows Media player functionality through COM. If I use Win32 C++, I can use it with no problems, so I thought that I could use Managed C++ as a "Bridge" to expose it to C#. The header file is the subscriptionservic...

WPF WinForms Interop issue with Enable / Disable

I have a WinForms usercontrol hosting a WPF custom Listbox in it. After the WinForms user control gets disabled and then re-enabled the WPF control in the WinForms usercontrol is unresponsive. Has anyone else experienced this? We had to hack a soultion into remove and re-add the element host each time the control gets disable / enable...

Can I stop a COM dll from displaying forms?

To be more specific: We have a web service (written in .Net) which utilizes a large number of COM dlls for core business logic (written in VB6). Assume for now that these are sealed libraries. Unfortunately, many of these COM libraries implement their own error handling or validation messages; if we pass in data which isn't complete, ...

How can I use C code in a C# Project? Wrapper class?

I have a C code and I want to use this in C#. Is there a possibillity except rewriting this code? ...

What methods can we use to interoperate programming languages ?

What can we do to integrate code written in a language with code written in any other language? Which techniques are more/less known? I know that some/most languages can be compiled to Java bytecode, but what do we do about the rest ? ...

How can I add a VC++ DLL as a reference in my C# Visual Studio project?

I want to add a VC++ DLL reference into my C# Visual Studio project. But when I try to add it I see, "It is not a valid assembly or COM component". Please suggest how I can use the VC++ DLL as a reference in a C# project. ...

C# DllImport return type is TCHAR?

Hi, I have a c++ function with the following signature TCHAR *DXGetErrorDescription9(HRESULT hr); I have [DllImport("dxerr9.dll",EntryPoint="GetDXErrorString9")] static public extern string GetDXErrorString9(int DXError); how do i marshall string to TCHAR*? Thanks ...

Getting data from C# to Excel 03/07

I have files with tons of real time data that I process with an C# application. After processing the data it is presented in Excel using a specific template. This is solved using Interop today. I must say I don't completely gasp the whole Interop situation. Do I have to manually install the Interop functionality on each end user termina...

VB6 to C# interop: Cannot directly set a property of type 'object'

Given the following C# class: namespace ComTest { [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] [Guid("A1D11BE5-40A1-4566-A1CA-418ABC76017C")] public interface IThing { [DispId(1)] void SetValue( object input ); [DispId(2)] object Value {get; set;} } [ComVisible(true)] publ...

"Type mismatch" error when calling a simple method in a c# assembly registered for COM interop

I've build a classlibrary using c# and the .net framework 3.5. In my class library there is a class called Utilities with two methods. public string Method1(int length) { } public string Method2(int length, string aStringParameter) { } Now I went and build a simple asp page calling my methods. Method1 work like a charm. Method2 cause...

Is there a best practice for accessing C++ native COM functions to interop from C#

For example, if I have 100 C++ methods (basically a native library) that interacts with a core window component. I want to basically make a wrapper for these c++ methods in C#, so all my new hire employees can use that instead of C++, etc. the C++ code is legacy and scares me, so I Want to deal with it just once. Is the approach here, ...

Inspecting a Word mail merge data source programmatically

I want to iterate over all rows of a MS-Word mail merge data source and extract the relevant data into an XML. I'm currently using this code: Imports Microsoft.Office.Interop Do objXW.WriteStartElement("Recipient") Dim objDataFields As Word.MailMergeDataFields = DataSource.DataFields For Each FieldIndex As Integer In mdictMergeFi...

C# Binary Behaviour in Internet Explorer

I'm trying to implement binary behaviour by using the C# language. I found a great article with a lot of workarounds, So I've implemented my program's behaviour exactly like it was described in the article. But when I run the program, I find that some code isn't executed: <object id="mybehav" classid="http://localhost:81/mycontrol /MyCo...

Managing a COM object in C#

I have an ATL COM exe that I am calling from C#. I import the reference into C# and everything works just fine, the exe is spawned, and I can call functions on it. Now, I instantiate several of these COM objects. Occasionally one of them will hang. Releasing the COM object does nothing, since its still running. I can't kill the process, ...

.Net Excel Interop Deleting a worksheet

I'm trying to delete a worksheet from a excel document from a .Net c# 3.5 application with the interop Excel class (for excel 2003). I try many things like : Worksheet worksheet = (Worksheet)workbook.Worksheets[1]; worksheet.Delete(); It's doesn't work and doesn't throw any error ... ...

Interop sending string from C# to C++

I want to send a string from C# to a function in a native C++ DLL. Here is my code: The C# side: [DllImport(@"Native3DHandler.dll", EntryPoint = "#22", CharSet = CharSet.Unicode)] private static extern void func1(byte[] path); public void func2(string path) { ASCIIEncoding encoding = new ASCIIEncoding(); byte[] arr = encodi...

"Already listening" when invoking an RPC call

I use Microsoft RPC for interprocess communications. I have an interface with a set of methods accepting a byte pipe as an "in" parameter (IDL description): [ uuid(ActualGuidHere), version(1.0), pointer_default(unique) ] interface IMyInterface { //other irrelevant methods here error_status_t rpcDoAction( [in] pipe...

RuntimeCallableWrapper

i got one COM component and want to access from C#.I created a interface in my C# program and want to access that component with its CoClass.When i created a object it gives me __ComObject which is a RuntimeCallabelWrapper. I want to know when it returns me a object and it create a MethodTable for me, then when i cast this interface to...