com

GetActiveObject() vs. GetObject() — MK_E_UNAVAILABLE Error

大憨熊 提交于 2019-12-10 18:37:32
问题 All: I am having some problems translating some VBA code to C#. We have a 3rd party app which acts as a local COM server. In the VBA code we use GetObject() to get a reference to the existing object e.g. Set appHandle = GetObject("", ProgId) this works fine. I added a reference to the 3rd party app in our c# code, and used Marshal.GetActiveObject() to try and get a reference to a running instance. e.g. var appModel = (IAppCoModel)Marshal.GetActiveObject(ProgId); but I keep getting a MK_E

Why is my COM factory never released during the program lifetime?

不想你离开。 提交于 2019-12-10 18:37:12
问题 I have a native C++ ATL in-proc COM server. A separate test program calls CoInitialize() , calls CoCreateInstance() , then calls Release() on the pointer, then calls CoUnitialize() and exits. If I run the test program under Visual C++ debugger the debug CRT reports a single memory leak and each time the allocation number is the same. I used an allocation hook and found out that the object not being returned to the heap is the class factory object. So basically the following happens: the

Where are COM method calls executed

自作多情 提交于 2019-12-10 18:17:16
问题 Let's say, I am executing an exe written in c#(just my choice of language). It has the following piece of code: var comObj=new ComClass(); comObj.DoSomething(); Now, I would like to know in which process is the DoSomething method executed. Is it the same process where the current exe is running or a different process responds to the DoSomething call? 回答1: From COM Clients and Servers There are two main types of servers, in-process and out-of-process. In-process servers are implemented in a

Automating Internet Explorer using C/C++

旧城冷巷雨未停 提交于 2019-12-10 18:07:00
问题 I want to write a small utility which can automate internet explorer using C++ (No MFC) . Some of the actions which i want to automate are :- 1. Opening a url 2. Clicking on a hyperlink in the browser instance 3. Setting the value of text boxes 4. Checking checkboxes, drop down menus etc. I am an absolute beginner, and have no experience with COM , however i am currently in the process of learning. Can anyone guide me, like suggesting the resources and a breif outline of what i need to do to

Getting System.Runtime.InteropServices.COMException Error in Server Side Generated Excel

只愿长相守 提交于 2019-12-10 18:04:16
问题 We have a web application that generates excel spreadsheets and run macros on the server side. It then sends them to different individuals via email. It is a part of a legacy reporting style which we are transitioning but still supporting on our new application which we delivered as a website in IIS. I know it is a bad practice to do Office Automation as I saw info from Microsoft that this is not supported. It is also indicated in the answer here opening excel error: System.Runtime

Excel 2013 COM API Hangs ExportAsFixedFormat under Service Account

白昼怎懂夜的黑 提交于 2019-12-10 17:53:20
问题 I have a .NET Windows Service which calls the Excel 2013 COM API to export an excel document on PDF, I have tried this code with the Windows Service running under two different domain accounts, both local administrator on the machine running the code. Under my personal account, which I'm also logged into the machine as, the code executes as expected. Under the service account, which is an active directory account, that is not logged into the machine the excel document is opened but the export

VBA and “Class doesn't support Automation or does not support expected interface”

佐手、 提交于 2019-12-10 17:53:19
问题 I have .NET assembly with ComVisible class. Some days ago (I can find that moment exactly, by git) something happened - Excel doesn't see anymore this class. So: I have interface [ComVisible(true)] [InterfaceType(ComInterfaceType.InterfaceIsDual)] public interface MyInterface { ... } and class [ClassInterface(ClassInterfaceType.None)] [ComVisible(true)] [ProgId("MyClass.Id")] public class MyClass { ... } Excel creates the instance by Dim c as MyClass Set c = New MyClass Earlier everything

Why is “local launch” allowed for out-proc servers by default but “local activation” is not?

允我心安 提交于 2019-12-10 17:34:26
问题 I currently need to create a COM object that is served by an out-proc COM server from inside an ASP.NET handler. So every time I deploy the COM server I have to fire up DCOM Config and change the security settings. Specifically I need to ensure that both "local launch" and "local activation" is allowed fro the local user ASPNET. What surprises me is that when I open the relevant settings page "local launch" is already allowed but "local activation" is not allowed. That doesn't make sense -

Hiding Opened Excel File

冷暖自知 提交于 2019-12-10 17:29:36
问题 here is my question: I have developed a program that uses Microsoft.Excel COM components in order to read/write over Excel files. Well, my app is doing good but when I open, for instance, another file directly with Excel while my program is running, the file(s) that my app uses appear within Excel. I do not want this. I tried also the Visibility property of Excel Application class, but that was not the solution, it just does not work. NOTE : I have checked this question out. Restrict access

Using Activation Context API with many dlls in different locations

穿精又带淫゛_ 提交于 2019-12-10 17:26:50
问题 I am using Activation Context API in a .Net client running in a location A to load a COM component reg-free in location B (which is completely different location to A, not a sibling/descendent etc. on the same machine) on WS2008 by passing in location B in the ACTCTX and it works fine. However, I now need to do the same thing with another COM dll which in turn has dependencies on a couple of .Net COM assemblies which live in completely different locations. I have added the dependent .Net