com

Reg free COM interop with C#, possible?

落花浮王杯 提交于 2019-12-03 00:53:15
Is it possible to use registration free COM with Dotnet interop and C#? If so how does one add a reference to the COM object in the C# project? I have a reg free ATL COM server dll with an embedded manifest and two test clients, one cpp the other c#. The cpp client correctly references the COM object using an import statement and either #pragma comment(linker, "\"/manifestdependency:type='win32' name='TestComSvr2' version='1.0.0.0'\"") or setting 'Additional Manifest Dependencies' to "type='win32' name='TestComSvr1' version='1.0.0.0'" under Linker->Manifest File options, after which the cpp

COM cannot start out-of-process .Net server compiled as AnyCPU

倖福魔咒の 提交于 2019-12-03 00:07:52
I am trying to get COM to start my out-of-process .NET COM server. It works if the server process is compiled with x64, but if I use AnyCPU (which is what I want) then it hangs for a while and eventually fails with 0x80080005 (CO_E_SERVER_EXEC_FAILURE). How can I get this to work? I am running on a 64-bit machine: Windows 7 with Visual Studio 2008 SP1. I can see in Task Manager that it does start my server. So I guess the problem is in the communications between COM and the server (class registration). My test client application is written in C#, but it doesn't matter whether it is compiled

What is the closest thing to Windows COM/DCOM in the Linux world?

末鹿安然 提交于 2019-12-02 22:26:40
Anything higher-level, and more comprehensive than pipes/sockets? Yes, there are lots of things, but there isn't one as "Standard" as COM/DCOM. At least, in Windows, COM / DCOM are used by "Windowsish" stuff, and other RPC mechanisms are used by un-"Windowsish" stuff. Linux doesn't have anything like that, instead things which need higher level RPC protocols typically use whatever their language provides, or a specific library which best suits an app's needs. Examples of that would be RMI in Java, Python's "pyro" module, etc, which will provide (some) functional parity with DCOM. Corba is a

How to make properties visible to COM in a .NET DLL (Methods DO work)

只谈情不闲聊 提交于 2019-12-02 22:20:07
问题 Solved, see comments! I have a simple .NET DLL written in c#. In asp-classic or VB.NET i can create the object and call a member function in the DLL without any problem. But, and this is my stumbling point, i can't access class properties. Here's the sample code: [Guid("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"), ClassInterface(ClassInterfaceType.None), ComSourceInterfaces(typeof(IComEvents))] public class Com : IComInterface { public string MyProperty{ get; set; } // <-- NOT ACCESSIBLE public

Multithreaded C++ application using Matlab Engine

我的未来我决定 提交于 2019-12-02 21:33:12
问题 I open Matlab engine in an initialization thread, doing : bool MY_MATLAB_ENGINE_o::Open() { // Handle the case where engine is already open if( MatlabEngine ) { return true; } else if( !( MatlabEngine = engOpen( 0 ) ) ) { return false; } IsEngineOpen.SetValue( true ); return true; } Function engOpen() opens a COM channel to Matlab. Once the engine is open, the thread falls in wait event mode. Then, in another thread, I do this : bool MY_MATLAB_ENGINE_o::ChangeDirectory( QString strPath ) {

C# string marshalling and LocalAlloc

不问归期 提交于 2019-12-02 21:31:20
问题 I have a COM callback from an unmanaged DLL that I need to use in C#. The unmanaged DLL expects the callee to allocate memory using LocalAlloc (which the caller will LocalFree ), populate it with WSTR and set value and chars to the WSTR pointer and string length respectively. Code snippet I'm trying to convert to C#: STDMETHODIMP CMyImpl::GetString(LPCSTR field, LPWSTR* value, int* chars) { CStringW ret; if (!strcmp(field, "matrix")) { ret = L"None"; if (...) ret.Append(L"001"); else if (...)

How do I call .NET code (C#/vb.net) from vbScript?

匆匆过客 提交于 2019-12-02 21:17:46
I imagine I can compile a C# DLL and then expose it as a COM object so that it can be CreateObject'd from VBscript. I'm just not sure the steps involved in doing this... It can be very simple to do this. But there are a lot of places where it's not so simple. It depends a lot on what your class needs to be able to do, and how you intend to deploy it. Some issues to consider: Your class has to have a parameterless constructor. It can't expose static methods. Is deploying your COM DLL in the global assembly cache OK? If not, you're going to have to give it a strong name and register it using

COM outbound call results in “An outgoing call cannot be made since the application is dispatching an input-synchronous call.”

ぃ、小莉子 提交于 2019-12-02 21:05:09
I have a COM server (C++/STA (MFC based app)) and a COM client (C#/MTA). The COM server must live in an STA, since it's an MFC app (I have no choice in this matter). The client issues a call to the server, and the server issues a callback to the client. That's where the error happens ( RPC_E_CANTCALLOUT_ININPUTSYNCCALL ). I'm guessing if the server had been an MTA, this problem would never have arised, but sadly, the documentation for MFC explicitly denies initializing the apartment as an MTA. Any ideas on how to work around this problem? I have been toying with the idea of letting the server

How to embed .tlb as a resource file into .NET Assembly DLL?

爷,独闯天下 提交于 2019-12-02 20:54:00
We're using our .NET Assembly DLL within native C++ through COM (CCW). Whenever I make new version of my DLL, I have to send two files (.dll and corresponding .tlb) to crew that's using it in their code. Is it possible to embed .tlb file as a resource in .NET DLL file? It is not exactly straightforward to do this with Visual Studio .NET, but it can be done. At a basic level, what you have to do is this: Generate your TLB file, e.g., "YourLibrary.tlb". Create a Win32 resource script file called, for example, "YourLibrary.rc" using a text editor (such as Notepad, or File/New/File.../Text File in

C# class attributes not accessible in Javascript

扶醉桌前 提交于 2019-12-02 20:04:25
问题 I want to make a class of mine accessible in JavaScript via a C# WebView-Control. Therefore I am using the WebView.AddWebAllowedObject method. However if I assign an attribute, it works fine, but if I assign the whole class to get all attributes in js, all of the attributes(and methods btw) are "undefined". I tried everything I found in the www. See the attached code: //The class I want to make accessible [AllowForWeb, ComVisible(true)] [MarshalingBehavior(MarshalingType.Agile)] public class