com-interop

Under what conditions is CCmdTarget::OnFinalRelease called?

自闭症网瘾萝莉.ら 提交于 2019-12-02 04:23:43
问题 The MSDN documentation for the CCmdTarget::OnFinalRelease method is pretty brief: Called by the framework when the last OLE reference to or from the object is released. I have created a sub-class of CCmdTarget class CMyEventHandler : public CCmdTarget { ... } I'm trying to figure out under what conditions the OnFinalRelease method will be called. I have some code that looks something like this: CMyEventHandler* myEventHandler = new CMyEventHandler(); LPUNKNOWN pUnk = myEventHandler-

VBA can't find C# dll entry point

元气小坏坏 提交于 2019-12-02 04:14:00
问题 I'm creating a dll in C# which runs a simulation when a single function runSimulation() is called. This dll should be called from VBA, as certain parameter values are given as input in Excel. This is the code I use. C#: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; using System.Windows.Forms; using System.Runtime.InteropServices; using RGiesecke.DllExport; namespace Simulation { public static class

Cannot instanciate .Net COM object in classic ASP/VBScript page (Error ASP 0177)

不打扰是莪最后的温柔 提交于 2019-12-02 02:23:59
问题 I've written a COM interop enabled class-library in C# using .Net 3.5. The object is meant to provide some utility functions for classic ASP pages. I've written a test.asp page which instanciates the desired object and calls its methods. Works fine on my machine. On a different machine (Windows Server 2003 - Standard Edition) it doesn't work eventhough the assembly is registered with regasm correctly. I've checked the regedit and afaik it looks ok. The error I'm getting is "ASP 0177" (error

Microsoft Interop saveAs command failed

空扰寡人 提交于 2019-12-02 02:16:59
I have this simple console app that converts Word documents to PDF using Microsoft Office Interop API. For some reason, this one document always fails and I have attached it and removed all extraneous content: click here For some reason, it works fine when you open the document and perform the saveAs function in Word, but through code, it fails. I've tried SaveAs2, SaveAs and ExportAsFixedFormat methods. I'm running Office 2010 and using Microsoft Word 14.0 Object Library. Thanks. My C# code is as follows Object missing = Type.Missing; String file = @"C:\Test\bad2.doc"; Word.Application

MFC Dll with COM Interface

让人想犯罪 __ 提交于 2019-12-02 02:15:35
问题 I am pretty new to managed/unmanaged interoperability and COM concepts. I received a suggestion of using COM Interop, for using my existing MFC code in C#. But the problem for me is, i have a MFC Dll which is not a valid COM component. How can I make this MFC DLLs to have COM-accessible interfaces ready for use in .NET? 回答1: From thread Loading MFC DLL in C# Windows Application To access native code from C# you have a few choices. Most directly, you can use DllImportAttribute to describe your

MFC Dll with COM Interface

北城以北 提交于 2019-12-02 01:42:29
I am pretty new to managed/unmanaged interoperability and COM concepts. I received a suggestion of using COM Interop, for using my existing MFC code in C#. But the problem for me is, i have a MFC Dll which is not a valid COM component. How can I make this MFC DLLs to have COM-accessible interfaces ready for use in .NET? From thread Loading MFC DLL in C# Windows Application To access native code from C# you have a few choices. Most directly, you can use DllImportAttribute to describe your DLL's entry points in C# terms so that they can be called via P/Invoke. They'll look like static methods to

Cannot instanciate .Net COM object in classic ASP/VBScript page (Error ASP 0177)

浪子不回头ぞ 提交于 2019-12-02 00:19:33
I've written a COM interop enabled class-library in C# using .Net 3.5. The object is meant to provide some utility functions for classic ASP pages. I've written a test.asp page which instanciates the desired object and calls its methods. Works fine on my machine. On a different machine (Windows Server 2003 - Standard Edition) it doesn't work eventhough the assembly is registered with regasm correctly. I've checked the regedit and afaik it looks ok. The error I'm getting is "ASP 0177" (error code), "8000ffff; Server.CreateObject-Fehler" (error description) which translates to Server

TLB to managed .NET assembly without Regsrv32 at deploy time

跟風遠走 提交于 2019-12-02 00:10:58
I have a TLB that was provided as a part of a third-party API. I used TLBIMP.exe to generate a DLL assembly wrappper. However, at development time, it appears that the assembly requires registration with regsvr32 to be used. This isn't a problem at development time however; I am using managed instances in production and registering the DLL manually will be a pain if not impossible when I deploy. Is there a way to use the managed DLL assembly in a way that doesn't require the registration step during deployment? I've been reading around the Internet and have found some literature on

how to stop macros running when opening a Word document using OLE Interop?

江枫思渺然 提交于 2019-12-01 22:05:14
问题 As the title suggests, I have a .Net application which uses interop to open documents in Word. I have set app.AutomationSecurity = Microsoft.Office.Core.MsoAutomationSecurity.msoAutomationSecurityForceDisable before opening the document. According to the documentation, thhis "Disables all macros in all files opened programmatically, without showing any security alerts" However, when I attempt to open one specific document I get a dialog box on the screen that says "could not load an object

How to cast System.Object[*] to System.Object[] II

℡╲_俬逩灬. 提交于 2019-12-01 21:21:27
I have got a similar problem like Cheva had in his Question: How to cast System.Object[*] to System.Object[] I use an external library (Reuters EIKON API) via the COM interop functionality. After submitting a request, the object gets updated and its data member gets updated. The Object catalogue shows this for the Data member: public virtual dynamic Data { get; } In the debug mode, I can see, that after submitting the request, DataStatus changes to dataset_full and the Data member is actually filled. The data member is shown as {object[1..31]} and I can see from the debug dropdown menu, that