com

Callback from a C++ COM DLL to a C# application

a 夏天 提交于 2019-12-11 01:29:08
问题 This is going to be a long post, as I want to expose you all the steps I tried to make this work :) I have C++ COM dll which contains a VideoPlayer class which uses the Media Foundation API to display a video. The VideoPlayer class is defined using an IDL file: [ object, uuid(74FDBBB1-BFFB-4F7E-ACA3-ADB0C7232790), dual, nonextensible, pointer_default(unique) ] interface IVideoPlayer : IDispatch { [id(1)] HRESULT Initialize([in] HWND* video_hwnd, [in] HWND* event_hwnd); [id(2)] HRESULT OpenUrl

Get functions/objects of imported .tlb

拥有回忆 提交于 2019-12-11 01:29:02
问题 I've got a program which shipped with a .tlb file to access some functions/objects (read variables etc.) with my own C++ program. I did a search and imported the .tlb file with: #import "MyLib.tlb" named_guids no_namespace I can also import it by using the libid from oleview.exe (ProgId does not work). Even if I get some warnings (as follows), my program still runs: C4278 ['TextOut', 'CreateEvent', 'DeleteFile'] is already a macro; use the 'rename' qualifier But.. how can I gain access of the

Failed to load C module in new appdomain

梦想的初衷 提交于 2019-12-11 01:14:02
问题 I have some .NET code that need to run in a separate AppDomain, and everything goes well except when there is call of COM component. To make it clear, I wrote a very simple repro as below: AppDomain ap = AppDomain.CreateDomain("newap"); ap.DoCallBack( () => { //GroupPolicyObject is from assembly microsoft.grouppolicy.management.interop.dll GroupPolicyObject newGPO = new GroupPolicyObject(); }); The exception: System.TypeInitializationException: The type initializer for '' threw an exception.

Python com between python and excel

时光毁灭记忆、已成空白 提交于 2019-12-11 00:51:48
问题 I'm trying to learn some python and I wanted for python to interact with excel using the win32 module. I found a basic example online on wiki here. It won't work however. This is the error I get. Traceback (most recent call last): File "C:/Users/Greg/Desktop/python programming/excel2.py", line 8, in <module> sheet.Range("A2").Value = str(Application.SIFilter(None, c.siObjectFilter)) NameError: name 'Application' is not defined My question is what does that line DO EXACTLY and why am I getting

Is there a way to tell whether two COM interface references point at the same instance?

断了今生、忘了曾经 提交于 2019-12-11 00:48:04
问题 Given two interface references obtained from different sources. Is there a programmatic way to tell whether they're implemented by the same instance? A simple equality check of the interface references always fails. EDIT: Large parts of the original question, which turned out to be an independent problem have now been moved to a new question. 回答1: You could query for the IUnknown interface and compare these pointers. All other interface pointers are not guaranteed to return the same value

Creating NPAPI plugin in Delphi and accessing exported APIs using javascript

家住魔仙堡 提交于 2019-12-11 00:41:29
问题 I have found a useful billards physics library in Borland delphi for my hobby project. The code is object oriented(in Object pascal). I want to visualize it using webGL (javascript) in chrome browser. The idea is, I should have one call to make from the javascript which will access the interface from delphi lib and give me the new position, rotation and scale values in respective array. For this I want to develop an NPAPI lib Scriptable plugin in Delphi(Meaning NO UI only lib of APIs). 1)I

Reg-free COM - location of COM dll relative to client exe

时光怂恿深爱的人放手 提交于 2019-12-11 00:17:03
问题 I want to use reg-free com so that I don't have to register my legacy com component. However, I would like to be able to put the com dll in a location which is not in or below the directory of the client exe, e.g. ....\lib. I'm not able to do this in the server manifest file as it doesn't allow relative or absolute paths. Does anyone know if there is a way round this? UPDATE: I only found relative paths to work on XP. However, I can use absolute paths on Windows Server 2008 using the

Passing COM objects as parameters in C#

断了今生、忘了曾经 提交于 2019-12-10 23:14:51
问题 Given the following code, can someone explain why I can pass a COM object as a value parameter but not as a reference parameter? private void TestRelease() { Excel.Workbook workbook = excel.ActiveWorkbook; ReleaseVal(workbook); // OK ReleaseRef(ref workbook); // Fail } private void ReleaseVal(Object obj) { if (obj != null) { Marshal.ReleaseComObject(obj); obj = null; } } private void ReleaseRef(ref Object obj) { if (obj != null) { Marshal.ReleaseComObject(obj); obj = null; } } 回答1: This has

From .Net Framework 3.5 can't call vb6 dll. Retrieving the COM class factory for component with clsid failed due to the following error: 800aea5f

橙三吉。 提交于 2019-12-10 23:03:15
问题 I try to istanciate a Com dll(developped in VB6) from a ".Net Framework 3.5 Dll Library Project" and I get the following error: Retrieving the COM class factory for component with CLSID {...} failed due to the following error: 800aea5f. On the same machine I try to istanciate the COM dll from a VBScript and it's work fine. In addition I tried to unregister and re-register the dll without good results. Now from a windows applcation .net 3.5 I can istanciate the COM dll but it's impossible to

Registering implementation of a COM interface

こ雲淡風輕ζ 提交于 2019-12-10 22:19:35
问题 I'm new to COM programming. I've got a COM object (and associated IClassFactory) all ready to go, but I can't quite figure out how to go about registering the resulting DLL for use by other programs. The number of GUIDs I need to sling around is also unclear to me. The COM object I'm trying to register implements the IAudioSessionEvents interface. I have come across the DllRegisterServer and DllUnregisterServer functions, but I haven't found any clear demonstrations of their usage. What keys