interop

How to find in code the parent Window or WinForm of a WPF control?

I have a situation where I need to find the parent Window or WinForm which is hosting the WPF control. I need to get the handle of either the parent Window or WinForm whatever the case may be. The problem is when the WPF control is hosted in a WinForm using ElementHost. How can I find the Handle of the hosting WinForm from a WPF control...

Passing Args to Clojure from Java

I would like to embed Clojure code into Java. This site was helpful in the basics of setting this up, but the only arg it ever passes is of type String. I have tried using ints as well, and those also work. My question is whether there is some formatted way to pass in structured data to Clojure. In particular, I have a list of points I ...

How to speed up 'cold start' of .NET component called from VB6 app

I have a VB6 app which brings up a form by invoking a .NET DLL, but the problem is that this form takes almost 5 seconds to appear when the menu item is first selected in the VB6 app is selected. How can I speed this up? It is only slow for the first time, thereafter it is at an acceptable speed, like it is a native VB6 form. I'm t...

Forced Option Explicit Off with VB6 Interop Forms Toolkit 2.1

I'm using the VB6 Interop Forms Toolkit 2.1 to host a .NET Control inside of a VB6 form. I'm being forced to turn "Option Explicit Off". Is there any reason why I can't use the Interop Toolkit without turning "Option Explicit On" ? The weird part is that I am explicitly declaring declaring the variables in my file. It seems that by u...

Does order matter when registering, gac-ing assemblies for COM interop?

When registering .NET assemblies for COM Interop, I do two things, currently in this order: regasm /tlb:MyDll.tlb Mydll.dll gacutil /i Mydll.dll I use regasm to register the type library for COM and gacutil to install the assembly into the GAC. Does it matter which order I do these two actions? Also, as I make updates to my dll, do...

Do I need to force the GAC to reload an assembly? Is this possible?

I've added types to my .NET classes that I'm using for COM interop. To get it to work with my VB6 application, I unregistered the DLL and re-registered it (using regasm). I then uninstalled and reinstalled it to the GAC (using gacutil). The types are showing up in the VB6 object explorer, but when I run the application in the VB6 IDE,...

Why does accessing a COM object from .NET, without going through the Interop class, sometimes work?

When you interface a COM object from .NET code, VS creates an interop DLL, with interop classes. Example: You have a foo.dll the implements a COM library Foo, that includes an implementation of the COM interface "IBar". You add a reference to foo.dll to a .NET project. in /bin, you'll see an Interop.FooLib.dll. In the Object Browser...

.NET Interop SendInfo - Can't get it to work..?

I'm using the following code to simulate a mouseclick. However I get the following error message: File I/O of a structure with field 'dwExtraInfo' of type 'IntPtr' is not valid What am I missing here? Dim inputEvents(0) As Input Dim p As MOUSEKEYBDHARDWAREINPUT p.mi.dx = x p.mi.dy = y p.mi.mouseData = 0 p...

find out if there are hidden columns in excel

Hi all, I need to know if there hidden columns in the excel sheet. i used use the following which worked fine and then suddenly it stopped working.now it always returns false. bool.Parse(worksheet.PageSetup.Application.Columns.Hidden.ToString()) TIA excel 2007 .net 3.5 ...

How can be Interop of MSXML Node in C++/CLI as XMLTextWriter or related XML Usability

Hello, I have some native code which generates native XML node of MSXML. I need that root node in C++/CLI to be use as XMLTextWriter or in any form of XML in C++/CLI. Is there any interop available for MSXML Node for using in C++/CLI. Regards Usman ...

GetEffectiveRightsFromAcl throws invalid acl error

I am trying to get the effective rights a user has on a file using interop in C#. Following is the code I am using : public static FileSystemRights GetFileEffectiveRights(string FileName, string UserName) { IntPtr pDacl, pZero = IntPtr.Zero; int Mask = 0; uint errorReturn = GetNamedSecurityInfo(FileN...

Exception using Querytables in Excel Automation

Hi, I'm using Automation to populate a range in Excel using a querytable.. However, when I try to add a querytable to the qorksheet I get an exception. I checked the connection string and its working fine.. Can some one please help me with this?? public void writeproc1() { try { Worksheet ws = (W...

Multi-level interface inheritance with .NET and COM Interop

This question is a follow-up to my last question with a reference to COM Interop. Let's say I have the following 2 interfaces and implementing classes: public interface ISkuItem { public string SKU { get; set; } } public interface ICartItem : ISkuItem { public int Quantity { get; set; } public bool IsDiscountable { ...

QuickBooks: unresolved SDK reference?

When I build the MCInvoiceAddQBFC C# application of the sample QuickBooks SDK code, the build fails with C:\Windows\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets : warning MSB3245: Could not resolve this reference. Could not locate the assembly "Interop.QBFC8, Version=8.0.0.28, Culture=neutral, PublicKeyToken=31d8aec643e18...

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...

Releasing .NET objects from VB6 code

On .NET Rocks! Show 561, Carl and Richard talked about releasing unmanaged objects instantiated in managed code. If you have to release a COM object that's instantiated in managed .NET code, you have to call System.Runtime.InteropServices.Marshall.ReleaseComObject. Is there anything similar you have to do (or should do) when releasing ...

Hosting ActiveX control in WPF

I have an ActiveX control (written in Delphi) which I want to host in a WPF application. When I try to load it into the toolbox to add it to the XAML at design time, it is not shown in the list of available controls. Does anyone know what filters this list and why I can't see the control to add it? Edit This is where I get to - the hos...

Why attachment size given by Outlook programming interface is always wrong?

Hi, Trying to use Outlook Interop in C#, I noticed a curious thing. First I get the size of an attachment with Attachment.Size property. Second, I save the attachment to a file using Attachment.SaveAsFile method. Comparing the real size of a saved file and a size given by Outlook, I notice that the real, saved file is always smaller...

C# late binding to com/activeX server, trouble with one method

Hi I am fairly new to Interop/Com/ActiveX etc, so bear with me. I am late binding into a com/activex (not sure which one) server (basically an exe not a dll). I am successfully using all the methods in that server except for one, here is the description: VT_INT GetLastCCTError (variant *error_string); Description: This funct...

WPF App - MFC App interoperation

I have a small WPF application. I wish to integrate it within our exisiting systems. I have two COM servers implemented as MFC MDI apps, lets call them COM_Srv1 and COM_Srv2. COM_Srv1 needs to call a method of WPF app, say StartTask. On Task Completion WPF app notifies the COM_Srv1 app WPF app may need to invoke a method on COM_Srv2 to...