com-interop

Does .NET have a linker?

From Jon Skeet's blog: What does the following comment mean? // The line below only works when linked rather than // referenced, as otherwise you need a cast. // The compiler treats it as if it both takes and // returns a dynamic value. string value = com.MakeMeDynamic(10); I understand what referencing an assemb...

Hosting Microsoft Office application inside Silverlight 4?

I know that Silverlight 4 has support for COM interop via the AutomationFactory class. dynamic excel = AutomationFactory.CreateObject( "Excel.Application" ); excel.Visible = true; But this creates a separate window for the COM object. What I am missing here is if I am actually able to actually host an Office document inside my Silver...

Error While using Excel Interop's set_Value(XLRangeValueDataType.XLRangeValueMSPersistXML,object)

Hi, I am getting error while using the Excel Interops set_Value on a range. Any help/suggestion will be valuable. This is the code which is failing. using Excel = Microsoft.Office.Interop.Excel; Excel.Application xlApp = new Excel.ApplicationClass(); Excel.WorkBook WB = xlApp.Workbooks.Add(Type.Missing); Excel.WorkSheet WS = WB.Sheets...

Calling a native callback from managed .NET code (when loading the managed code using COM)

Hi, I am really confused by the multitude of misinformation about native / managed interop. I have a regular C++ exe which is NOT built using CLR stuff (it is neither Managed C++ nor C++/CLI and never will be). This C++ exe is "in charge", there is no managed wrapper for it. I would like to access some code I have in a C# assembly fro...

Regasm writes mscoree.dll into Registry key InprocServer32

When I register my .NET Assembly with regasm.exe the registry key HKEY_CLASSES_ROOT\CLSID{111E32AD-4BF8-495F-AB4D-6C61BD463EA4}\InprocServer32 is set to "mscoree.dll". However, I am trying to mimic an existing COM-Server that was written in C. When registering this old COM-server the InprocServer32 is set to the full path to this com...

Migration of .NET COM object to 64 bit.

Hi, We have C++ application which uses several COM object. COM object are .NET based (using COM Interop). I need to migrate application to 64 bit. I specifically need C++ application to be 64 bit. I don't want to recompile all of .NET com object to 64 bit and deliver two sets of DLL's (32 bit and 64 bit). I was investigating and foun...

.Net to COM Interop Tester

I made a class in C# that I am exposing to COM. I can register it just fine using RegAsm.exe. I would like to test it before I send it off, but using TlbImp.exe gives me an error of "Type libaray was exported from a CLR assembly and cannot be re-imported as a CLR assemply." What is a good way to test this? ...

Why would you need to run regasm and caspol on a .net component more than once?

Why would you need to run regasm and caspol on a .NET component more than once? I have a COM client that uses a .NET component residing on another machine. Consequently I need to run regasm and caspol on this .NET component. What could cause there to be the need to do this again on the same machine to the same component? Is the effec...

How can I manipulate a VB6 Collection in .NET?

Hello all, I am currently in the process of designing an interface for .NET software that would be consumed by COM objects - specifically, VB6. While I have found a number of pages by Microsoft detailing how to make an COM-interoperable interface, I am currently tripping over the use of Collections in design time: I would like to be ab...

Language neutral plugin architectures

I am looking at extending an existing application through the use of a plugin architecture. The application id written in Delphi, but I want to be able to implement various plugins in whatever language is best of the job. Currently we have skills in Delphi, C# and Java, and would like to be able to implement a plugin in whatever language...

Which collection interface should I use in .NET for COM-interop?

That is a followup from my previous question, but you don't need to read it to understand that one. I'm designing an interface in .NET that would be consumed from COM applications (mainly VB6, but Visual C++ 6 is also a possibility) and I would like to use Collection types as argument and return types for the methods in the interface. ...

Question about making Asynchronous call in C# (WPF) to COM object

Hi, Sorry to ask such a basic question but I seem to have a brain freeze on this one! I'm calling a COM (ATL) object from my WPF project. The COM method might take a long time to complete. I thought I'd try and call it asychronously. I have a few demo lines that show the problem. private void checkBox1_Checked(object sender, Routed...

MEF and unmanaged code

Is there a way of getting MEF to load unmanaged code, such as com objects that are not written Java or are native Win32 code ? ...

Why exception occured at LoadTypeLibEx System.ArgumentException: Value does not fall within the expected range?

Hello, I am loading type library in C++/CLI. In C# its loading successfully but it's giving again and again following exception in managed C++/CLI. exception occured at LoadTypeLibEx System.ArgumentException: Value does not fall within the expected range at LoadTypeLib(String strTypeLibName, ITypeLi b typeLib) Here's a PInvoke Signat...

Excel COM Interop - tlbimp vs primary WrapperTool

I'm trying to add the ActiveX Microsoft Excel 11.0 Object library to my .NET project. It works fine on my computer, but when I check in my code, it doesn't work on my coworker's. Fixed it on his and it broke mine. When added, the namespaces are different between our machines. It turns out the difference is that when I add the reference ...

Send already generated MHTML using CDOSYS through C#?

I have a ready generated MHTML as a byte array (from Aspose.Words) and would like to send it as an email. I'm trying to do this through CDOSYS, though am open to other suggestions. For now though I have the following: CDO.Message oMsg = new CDO.Message(); CDO.IConfiguration iConfg = oMsg.Configuration; Fields oFi...

.Net Com Interop: Return bool for a wrapped function that returns BOOL

I have COM function that returns BOOL -- which is simply a typedef for int -- and I'm generating a .Net wrapper using Visual Studio. Is there a way I can have the wrapper automatically convert the BOOL to the C# bool type and return that? ...

Reset Taskbar Flash in C#

I have an application where the taskbar flashes if an event has occurred. This is working perfectly, and was relatively easy to implement using a Win32 API described below: http://blogs.x2line.com/al/archive/2008/04/19/3392.aspx However, when I stop the flashing, sometimes the application is stuck in the "highlighted" state in the taskb...

Interop Forms Toolkit DLL and "Class does not support Automation or does not support expected interface" error

I have a .NET WinForms application that I've converted into a COM dll using the Interop Forms Toolkit 2.1. Thet setup project for the application has both my tlb as well as the Microsoft.InteropFormTools.tlb file set to Register as vsdrpCOM. The prerequisites for the project are to ensure that Windows Installer 3.1, .NET Framework 3.5 SP...

COM class Returning byte[] in .NET - Whether to release memory or not

I have a COM component having a MyDataObject class. There is a method with the following signature: HRESULT MyDataObject::GetData(long Format, VARIANT* retval) This COM object is used in a .NET application and the method returns either a string or byte array depending on Format value. The returned value is converted to a byte[] in .NE...