com

dynamic_cast of a COM object to a COM interface doesn't bump the reference count, does it?

荒凉一梦 提交于 2019-12-02 02:16:27
If I have a C++ class, X, which implements the COM interfaces IY and IZ, and I have a pointer y to the IY interface of an object of type X, and I do this: IZ *z = dynamic_cast<IZ *> ( y ); That doesn't bump the object's reference count, does it? I don't have to do a Release() to account for it, right? If it matters, I'm using ATL/COM. I'm guessing the answer is "no it doesn't bump the reference count, and no you don't have to Release()", but I want to make sure. Thanks in advance. Reference counts for COM objects are incremented when someone calls IUnknown::AddRef(). QueryInterface(),

Application hung during CoCreateInstance when using Isolated COM

纵饮孤独 提交于 2019-12-02 02:13:51
问题 When I don't configure a client DLL ( globalsd.dll ) to use Isolated COM to access a .NET assembly that exposes a COM interface ( FSCulture.dll ) before running the main executable ( FCMTSYSM.EXE ) I get an application exception (Access Violation) as the CoCreateInstance fails during the static initialization of the DLL ( syslev0.dll ) that calls the client DLL ( globalsd.dll ) during startup (the code continues to try to run and use the non-existent COM object). This much I understand and

Calling C# COM object

心已入冬 提交于 2019-12-02 02:04:16
问题 Ok, I've created a c# dll, made all its interface and methods all ComVisible(true). Added it to the GAC using gacutil, then registered it using regasm and created a type library tlb file. Now I have another c# project that I want to make calls to that com object, how can I do this? What would the code roughly look like to import the com object then use its calls? 回答1: First of all, why do you want to call that C# Assembly (that you've made comvisible) in your other C# project via COM ? That

When implementing several COM interfaces at once how do I upcast to IUnknown?

浪子不回头ぞ 提交于 2019-12-02 02:03:16
问题 Suppose my COM object implements two or more COM interfaces: class CMyClass : public IPersistFile, public IPersistStream { }; when implementing QueryInterface() I need to be able to return an IUnknown* pointer. Since both base interfaces are derived from IUnknown I cannot upcast implicitly - such upcast would be umbiguous. To upcast explicitly I need to use either of the two ways: if( iid == __uuidof( IUnknown ) ) { *ppv = static_cast<IPersistFile*>( this ); static_cast<IPersistFile*>( this )

MIDL changes the Interface name

眉间皱痕 提交于 2019-12-02 01:16:24
问题 I have a COM dll , which is consumed by .NET applications using COM Inter-op. In one of the CoClasses , there is an Interface called IT6TrackData and it has one get property called TrackData From the IDL file: Interface IT6TrackData { [propget, id(1)] HRESULT TrackData([out, retval] SAFEARRAY(BYTE) *pVal); } When the TLB file is viewed for the above IDL file, it shows the property as trackData ( t in lower case) For some reason the Client application were referring to this property as

How to programmatically register (set correct path to) a type library from within .NET?

余生长醉 提交于 2019-12-02 01:01:26
Using .NET 4.0, I have made a COM-enabled DLL (let's call it example.dll), and I have registered it and generated the respective type library using regasm.exe (regasm.exe /tlb /codebase example.dll); the type library is called example.tlb. The assembly is strongly named. This works so far, and I can use the DLL and the TLB from within VBA. But for certain reasons, I need to make my own utility which does the DLL registration and TLB generation. Basically, this utility will be in the same directory as the DLL and should register the DLL which it finds in that directory as well as generate the

How to check if a COM property or method exists without generating an exception?

我们两清 提交于 2019-12-02 00:53:27
问题 I'm working on some legacy code that creates a list of strings containing property and/or method names and then attempts to apply those properties or methods to a COM object. The property or method for the COM object is not guaranteed to exist and it could be either a property or a method I don't know which. At the moment if a property or method doesn't exist it's caught as a COM exception. This results in poor performance. I am trying to find a way to check if a property or method exists in

Application hung during CoCreateInstance when using Isolated COM

时光毁灭记忆、已成空白 提交于 2019-12-02 00:47:50
When I don't configure a client DLL ( globalsd.dll ) to use Isolated COM to access a .NET assembly that exposes a COM interface ( FSCulture.dll ) before running the main executable ( FCMTSYSM.EXE ) I get an application exception (Access Violation) as the CoCreateInstance fails during the static initialization of the DLL ( syslev0.dll ) that calls the client DLL ( globalsd.dll ) during startup (the code continues to try to run and use the non-existent COM object). This much I understand and can deal with. I need to improve the error handling and/or register the COM object with regasm and/or

Can't co-create object / Can't find moniker | Jacob

丶灬走出姿态 提交于 2019-12-02 00:40:45
问题 When creating an ActiveXComponent using JACOB I get the following error. com.jacob.com.ComFailException: Can't co-create object at com.jacob.com.Dispatch.createInstanceNative(Native Method) at com.jacob.com.Dispatch.<init>(Dispatch.java:99) at com.jacob.activeX.ActiveXComponent.<init>(ActiveXComponent.java:58) at com.paston.jacobtest.RidderIQ.main(RidderIQ.java:30) The COM object which I need to use from a program which doesn't register its DLLs by itself during installation. To register the

Is there any way to debug compiled components using Matlab Debugger?

老子叫甜甜 提交于 2019-12-02 00:31:18
问题 Is there a way in which I can debug my compiled Matlab components, using native Matlab debugger, like Visual Studio "Attach to process" option, or something like that? I mean EXE stand-alone files, DLLs, COM in-process servers or .NET components. 回答1: You can't debug them in the sense of being able to step through the MATLAB code line by line, as you can with MATLAB's own debugger prior to compilation. One of the steps that the MATLAB deployment products take is to encrypt the MATLAB code (so