com

Why is marking an assembly ComVisible(true) discouraged?

大城市里の小女人 提交于 2019-12-03 23:25:34
问题 I have always marked my .NET assemblies as visible to COM with [assembly: ComVisible(true)] , thinking that I never know when someone might need to call them from COM. I also started using FxCop and started seeing this warning from code analysis: CA1017 : Microsoft.Design : Because 'MyLibrary.dll' exposes externally visible types, mark it with ComVisible(false) at the assembly level and then mark all types within the assembly that should be exposed to COM clients with ComVisible(true) Is

Making Property Handler for my application to add custom properties to a file format

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 22:30:46
I wanted to add custom properties for my application file type, just like Microsoft Word file tyep .docx has properties on Details Pane in vista and window 7 that show author property and e.t.c trying to do the same for my application but have no clue yet. working in .net2.0 .i dont know what i am doing wrong, using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; using System.Runtime.InteropServices.ComTypes; using Microsoft.Win32; namespace TestShell { [ComImport] [InterfaceType

JSON.Stringify fails on Scripting.Dictionary objects

浪尽此生 提交于 2019-12-03 22:22:48
问题 I am working on an ASP classic project where I have implemented the JScript JSON class found here. It is able to interop with both VBScript and JScript and is almost exactly the code provided at json.org. I am required to use VBScript for this project by the manager of my team. It works very well on primitives and classes defined within ASP. But I have need for Dictionary objects which from my knowledge are only available through COM interop. (via Server.CreateObject("Scripting.Dictionary") )

Register for COM Interoperability

江枫思渺然 提交于 2019-12-03 21:59:23
I create the following class library in C#: [InterfaceType(ComInterfaceType.InterfaceIsDual)] //[Guid(<Generate GUID here>)] public interface _None1 { int retval { get; } } [ClassInterface(ClassInterfaceType.None)] //[Guid(<Generate GUID here>)] [ProgId("Lotr.Test")] public class None : _None1 { public int retval { get { return 1; } } } Then I compile it using "Register for COM Interop" and "Make Assembly COM-visible" options. When I try to access it using Excel 2007 VBA on my machine, works fine. However, if I take the .dll and .tlb files to another machine, and then use regasm to register it

com4j on Windows 64 bit

谁都会走 提交于 2019-12-03 21:10:19
问题 I've downloaded the latest com4j jars and I'm trying to run through the most simple of their examples. I'm on Windows 7 64 bit and using a 64 bit JVM. When I run the command (from the com4j tutorial): java -jar tlbimp.jar -o wsh -p test.wsh %WINDIR%\system32\wshom.ocx I get: Exception in thread "main" java.lang.UnsatisfiedLinkError: com4j-amd64.dll: %1 is not a valid Win32 application at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(Unknown

implement COM interface type library in python

坚强是说给别人听的谎言 提交于 2019-12-03 21:03:39
I have a plugin that I'm trying to create as a sample for an application from the company I work for. I'm trying to write this plugin in Python. The way the plugin architecture works is that the plugin needs to implement an interface defined in a provided COM type library. So it is a COM client to that type library and in the end gets registered as a COM Server to the registry and the application by giving it the ClassID for late-bound COM by the application. I'm using pythoncom and win32com and have used makepy.py to generate the needed python code from the type libarary but I can't seem to

Firing a COM Event From Another Thread

99封情书 提交于 2019-12-03 21:03:36
I have created an in-process COM object (DLL) using ATL. Note that this is an object and not a control (so has no window or user-interface.) My problem is that I am trying to fire an event from a second thread and I am getting a 'Catastrophic failure' (0x8000FFFF). If I fire the event from my main thread, then I don't get the error. The second thread is calling CoInitializeEx but this makes no difference. I am using the Apartment threading model but switching to Free Threaded doesn't help. The fact I am trying to do this from a second thread is obviously crucial. Is there an easy way to do

Is it possible to register a .NET assembly for COM interop without adding registry entries?

冷暖自知 提交于 2019-12-03 20:57:16
问题 I am deploying a .NET VSTO application via click once. The application's main assembly needs to be registered for COM interop as part of the installation process. I know that this can be done by writing code to execute "REGASM assembly.dll /tlb", but the problem is that the target workstations that will be installing my application don't have administrative rights, so the regasm fails when trying to register the type library. My question is, how can I register my .net assembly for com

How to get LINQPad to Dump() System.__ComObject references?

偶尔善良 提交于 2019-12-03 20:54:39
问题 I am playing around with using LINQPad to rapidly develop small ArcObjects (a COM-based library for ESRI's ArcGIS software) applications and have had some success in using it to Dump() the properties of COM objects that I initialize from .NET, but any COM objects that are obtained from an existing COM object are simply dumped as System.__ComObject references, which is not particularly useful: This help topic explains why this is happening, which I think I understand, but would like to know

How to Install a COM using ClickOnce

十年热恋 提交于 2019-12-03 20:45:16
I have installed my windows application that uses TeeChart ActiveX (a COM Component for charting) using ClickOnce. If I register manually TeeChart using regsvr32 teechart8.ocx, my application works fine. But I want and I need to install the application using ClickOnce. How can I do that? Orion Edwards ClickOnce can only copy files. So you have these options: Use Reg-Free COM as Jeff Hall suggests . This is probably the best option if you can do it. Run regsvr32 manually when your .exe file first loads (before it tries to access the COM objects) Create a custom clickonce prerequisite package