com

Consuming a .Net library via COM or direct integration in Java

北城余情 提交于 2019-12-04 04:40:59
问题 I have to admit the last time I programmed in Java was a data structures class in high school. So please be kind to this Java noob. I have spent a good deal of time putting together a C# COM library at work. This library relies heavily on some new .Net technologies (WPF being the big one) so translating it into another language is not really an option. I have tested consuming this library from C++ through the COM interface and that was simple enough. I wanted to also prove that this same

DCOM server and client both written in .NET

你离开我真会死。 提交于 2019-12-04 04:16:42
问题 I'm developing a DCOM server in .NET 4 (VS2010, C#). By itself, this is working fine. Now, I also need to develop a .NET client for this DCOM server, but I am unable to add a reference to the TypeLib. Visual Studio will tell me the type library was exported from a .NET assembly and cannot be added as a reference. Answers to this question suggests that I should be able to use TlbImp.exe to generate a wrapper assembly, but it will refuse to do so as well: TlbImp : error TI1029 : Type library

Exposing c# anonymous class objects to COM (JavaScript)

℡╲_俬逩灬. 提交于 2019-12-04 04:07:50
问题 Is there a class/API in .NET 4.5+ allowing to expose an instance of C# anonymous class as as late-bound object to COM? E.g. I want do this: webBrowser.Document.InvokeScript("TestMethod", new object[] { new { helloProperty = "Hello!", byeProperty = "Bye!" } }); and use it in JavaScript: function TestMethod(obj) { alert(obj.helloProperty + ", " + obj.byeProperty); } It should not be a problem to create a helper class to wrap the anonymous object and expose its properties via IReflect, but

How to get pointer to IUnknown in C#

巧了我就是萌 提交于 2019-12-04 03:39:28
.NET interop wraps COM objects into .NET objects (runtime-callable wrappers, RCWs), which hide the usual interface querying. In order to register a COM object representing a filter graph with the Running Objects Table, I need the (native) address of its IUnknown interface (see How can I reverse engineer a DirectShow graph? ). So the question is: How can I get a COM object's IUnknown pointer in C#? Hans Passant Use Marshal.GetIUnknownForObject() . 来源: https://stackoverflow.com/questions/3941349/how-to-get-pointer-to-iunknown-in-c-sharp

How to write an EXE which is also a COM Server in Delphi

我只是一个虾纸丫 提交于 2019-12-04 03:33:12
问题 I have a Delphi (2007) application which is just a standard exe, and I would like to add a COM interface to it. I already have a COM dll which exports several COM objects and this is working perfectly. However when I attempted to insert the COM logic from the dll (ie the "exports" and "{$R *.TLB}" and the relevant uses) into the EXE's dpr file it all compiles perfectly but refuses to register when I call regsvr32 myname.exe I also tried creating an completely new VCLForms application and

How to call managed C++ methods from Un-managed C++

倖福魔咒の 提交于 2019-12-04 03:30:38
问题 PLEASE SEE UPDATE BELOW (RESOLVED) Also I have extended this into a second question here Implement a C# DLL COM File In Unmanaged C++ Program I have researched this to the end of the internet without finding a real, understandable, human example of how to do this. I have a C# DLL that encrypts and decrypts text. I don't want to / don't have the intellectual capability to rewrite this in C++ un-managed code. So instead I created a C++/CLR class that interfaces with the C# dll. NOW I need to

How to release inprocess COM Server object from Excel VBA

南楼画角 提交于 2019-12-04 03:30:11
问题 How do you force Excel (2007) VBA to release references to a COM server object? I have written an inprocess (Single instance DLL) COM Server in Visual Foxpro 9 SP2 which is instantiated from Excel 2007 VBA code on my development machine. Excel seems to be holding a reference to the COM object/dll even though I set it = Nothing. This prevents me from rebuilding the DLL due to a "File access is denied TestCOM.dll" message until I quit Excel which is a pain everytime I want to make a change and

how does the .RGS file works

烂漫一生 提交于 2019-12-04 03:28:29
In the .rgs file, there are some registry info, and I want to know how does the info in .rgs file added into regetry? I have a project AAA and it will generate the file AAA.DLL , and there is a file xxx.rgs which contains the registry info, and the AAA.DLL is built, then it will be deployed to another machine B, so I don't know how the registy info can be added on machine B, do I need register AAA.dll using regsvr32 command? Usually your code calls CComModule::UpdateRegistryFromResource() which in turn passes control to a special mechanism implemented in ATL which does the job - parses the

Using Interop.MODI Throws 0x80040154 Exception

你。 提交于 2019-12-04 03:26:21
I am currently trying to implement the Interop.MODI.dll (From Microsoft Office) to use the Image -> Text features it should Provide. But when doing var modi = new MODI.DocumentClass(); I get: "COMException 80040154 with CLSID {40942A6C-1520-4132-BDF8-BDC1F71F547B}". What have I tried to solve that problem? I registered the DLL using the regasm tool: -Problem still exists I tried setting the BuildPlatform to x86: -Problem still exists I use the Visual Studio 2010 Ultimate with Windows 7 Professional 64Bit & Have Microsoft Office 2007 installed EDIT: I found the Solution: I needed to install the

Python clean way to wrap individual statements in a try except block

你离开我真会死。 提交于 2019-12-04 03:05:34
问题 I'm currently doing some Python automation of Excel with com. It's fully functional, and does what I want, but I've discovered something surprising. Sometimes, some of the Excel commands I use will fail with an exception for no apparent reason. Other times, they will work. In the VB equivalent code for what I'm doing, this problem is apparently considered normal, and is plastered over with a On Error Resume Next statement. Python does not have said statement, of course. I can't wrap up the