com-interop

Error when accessing a COM dll with Threading Model Apartment from Multithread Apartment

我与影子孤独终老i 提交于 2019-12-11 05:52:07
问题 I have to communicate with a third party application and the only way to do so is by accessing the provided COM component. Because the interaction takes about 3 minutes it's mandatory that it takes place in the background. So what i tried to do is to add a reference the component with option "embedd interop-types" = true and to create a test that reads very basic data through the interface. The documented way to do so is by following Code: System sys = new System(); if(Convert.ToBoolean(sys

Calling C# DLL from ASP on Compact Framework (Windows CE)

空扰寡人 提交于 2019-12-11 05:49:11
问题 I am writing an ASP application on Windows CE that will need to call business logic that exists in a .NET DLL (C#). It appears as though although the Compact Framework allows us to call native code from managed code, the CF doesn't allow us to call managed code from native code. - But, I'm not 100% sure on this. Has anyone had success using COM Interop to call methods from a managed dll from ASP on CF? If so, can you point me to where I can learn how to do it? If not, given that I must use

Registration Free COM errors with EXE

混江龙づ霸主 提交于 2019-12-11 05:37:08
问题 I'm trying to use COM functions exposed by an EXE. I've created a C# project using Visual Studio 2010 (on a windows7/x64 machine) and added the reference to that EXE, then set the Isolated flag to true. When I build the solution, I get errors for each of the classes that it exposes. Problem isolating COM reference 'FNCClient11Lib': Registry key 'HKEY_CURRENT_USER\SOFTWARE\CLASSES\CLSID{e49b30c9-6d7e-48f5-91da-f2f0414c6a13}\InProcServer32' is missing value '(Default)'. These entries don't

Finding the source DLL name from Interop assembly via reflection

佐手、 提交于 2019-12-11 05:19:34
问题 I have an Interop DLL RCW.Xyz.dll but I can't find the corresponding DLL. Because the name doesn't follow the default naming scheme Interop.Xyz.dll my guess is that the interop assembly was simply renamed. (Even if the DLL is generated by Visual Studio with a default name, if the DLL has spaces in its name, the spaces will get lost, making it hard to find the source DLL again) How can I find out the COM DLL name behind the interop assembly? I assume I need to use disassembly tools. Preferably

Casting mshtml.IHTMLImgElement to mshtml.IHTMLElementRender fails with E_NOINTERFACE

Deadly 提交于 2019-12-11 04:48:46
问题 I have C# .NET 4 WinForms app (using MSHTML 7) that launches new and connects to existing IE 10 instances. It iterates through all images and downloads them to manipulate. This approach is time-consuming and redundant since the image has already been downloaded by IE. I have searched everywhere and only a handful of forums discuss the subject but all are able to cast mshtml.IHTMLImgElement objects to mshtml.IHTMLElementRender (although in C++ code). Unable to cast COM object of type 'mshtml

Passing javascript Date object to C# WebBrowser control using window.external

自闭症网瘾萝莉.ら 提交于 2019-12-11 04:26:05
问题 I am able to call C# methods of WebBrowser.ObjectForScripting with javascript window.external from WebBrowser WinForms control and pass string , int , bool etc. However I don't know how to pass javascript Date object and somehow convert/marshal it to .NET DateTime class. Obviously, I could pass a string and parse it, but this is really not the point. I'm just curious how could I do it with javascript Date and .NET DateTime ? 回答1: You can take advantage of the fact that dates in Javascript are

COM interop: Variable number of parameters

Deadly 提交于 2019-12-11 03:34:10
问题 I am developing an C# libraries, that I need to call from COBOL (unmanaged) code. So I am using COM interop for these purposes. I have created an layer "ModuleLanucher" that mediates the communication. I have registered this ModuleLanucher library by these commands: regasm ModuleLanucher.dll /codebase TLBEXP Modulelanucher.dll Everything works fine if I have concrete number of parameters in function foo. (mentioned below) Unfortunately my function foo needs variable number of arguments. This

DCOM Config settings for Microsoft Interop Word Automation

你说的曾经没有我的故事 提交于 2019-12-11 03:16:03
问题 I am using Microsoft Office Interop Word to generate documents using C#. In order for the document generation to work, there should be an entry for the "Microsoft Office Word 97 - 2003 Document" under the Dcom Config Settings as shown below: The Local Path under the General Tab has a correct path when Microsoft Office is first installed. If I then join the computer to a Domain, and then restart the system with a Domain user, the Local Path becomes blank and the application doesn't generate

import vb.net class library to vb6 project

最后都变了- 提交于 2019-12-11 03:00:14
问题 I have created a vb.net class library. It is an interface for a storage device. It gives some objects and methods in order to read and write data to the device. The problem is that a customer has a vb6 application where we want to add the functionality of the class library in order to manipulate the device. i have changed the classes to com classes, checked the com interopt checkbox and registered the library with .net framework 2.0 regasm.exe. I added the library as reference to a blank vb6

Is it possible to use VB6 enums which have values with spaces in C#?

好久不见. 提交于 2019-12-11 02:44:57
问题 We have a VB6 DLL which includes several enum definitions. We have loaded the VB6 DLL as a reference in a C# project. In VB6, you can declare enum values which have names with spaces in them, using a special square bracket syntax. Examples: Public Enum TestEnumNoSpaces EnumA EnumB EnumC End Enum Public Enum TestEnumWithSpaces [Enum A] [Enum B] [Enum C] End Enum If you compile this to a DLL and load it as a reference in Visual Studio 2010, in the object browser both enums are visible. However,