com

Should there be a difference between an empty BSTR and a NULL BSTR?

你说的曾经没有我的故事 提交于 2019-12-29 04:47:07
问题 When maintaining a COM interface should an empty BSTR be treated the same way as NULL ? In other words should these two function calls produce the same result? // Empty BSTR CComBSTR empty(L""); // Or SysAllocString(L"") someObj->Foo(empty); // NULL BSTR someObj->Foo(NULL); 回答1: Yes - a NULL BSTR is the same as an empty one. I remember we had all sorts of bugs that were uncovered when we switched from VS6 to 2003 - the CComBSTR class had a change to the default constructor that allocated it

Directshow filter access threading

我是研究僧i 提交于 2019-12-29 01:28:10
问题 I made a TV-Player in c# using directshowlib-2005. now I made a method to search for available channels. I want this method to run in a different thread so my GUI won't freeze, but I get an error when I try to set the channel in the method. It can't find the IAMTVTuner interface in my graph, altough I know it's there. If I don't use a different thread, the method works just fine (but my GUI freezes for a while) I know it has to do something with apartments, but is there a way I can acces that

Invoke method using Reflection on COM Object

筅森魡賤 提交于 2019-12-28 15:58:45
问题 I have an instance of a COM object... which is created like this: Type type = TypeDelegator.GetTypeFromProgID("Broker.Application"); Object application = Activator.CreateInstance(type); When I try to invoke a method: type.GetMethod("RefreshAll").Invoke(application, null); -> type.GetMethod("RefreshAll") returns null . When I try to get all the methods with type.GetMethods() , there is only these methods: GetLifetimeService InitializeLifetimeService CreateObjRef ToString Equals GetHashCode

Are *.tlb files ever used at runtime?

夙愿已清 提交于 2019-12-28 12:47:58
问题 I'm working on a product that exposes some .NET API through COM interop. As a part of the build we generate *.tlb files for all such assemblies and deliver them as a part of a separate SDK package. Our customers can install the SDK on top of our product and create applications that use our COM API. Do we need to ship and register those *.tlb files with the product itself? Is there a situation when *.tlb are required at runtime, when third-party libraries coded against them are executed?

How to use IDispatch in plain C to call a COM object

左心房为你撑大大i 提交于 2019-12-28 08:40:11
问题 I need to compile some code of mine using the gcc compiler included in the R tools (R the statistical program for windows), the problem is that I need to use IDispatch in my code to create an access the methods of a COM object, and the gcc compiler doesn't support much of the code that I'm using to do so, which is basically C++ code. So my question is how can I use IDispatch in C to create the COM object without having to depend on MFC, .NET, C#, WTL, or ATL. I believe that if I do so I will

How to use IDispatch in plain C to call a COM object

纵饮孤独 提交于 2019-12-28 08:40:09
问题 I need to compile some code of mine using the gcc compiler included in the R tools (R the statistical program for windows), the problem is that I need to use IDispatch in my code to create an access the methods of a COM object, and the gcc compiler doesn't support much of the code that I'm using to do so, which is basically C++ code. So my question is how can I use IDispatch in C to create the COM object without having to depend on MFC, .NET, C#, WTL, or ATL. I believe that if I do so I will

reusing Internet Explorer COM Automation Object

情到浓时终转凉″ 提交于 2019-12-28 04:25:06
问题 I am using VBScript macros to utilize the InternetExplorer.Application COM automation object and I am struggling with reusing an existing instance of this object. From what I have read, I should be able to use the GetObject() method in vbscript to grab a hold of an existing instance of this object. When I execute the following code I get an "Object creation failed - moniker syntax error". Is my issue really syntax? Is my issue how I am trying to use this object? or can what I am trying to

Exposing Property as Variant in .NET for Interop

时光毁灭记忆、已成空白 提交于 2019-12-28 02:53:11
问题 I am creating a wrapper class in .NET (VB.NET as it happens but is equally related to C#) that is exposed to COM and one of the properties I am trying to wrap is a Variant. I thought I would just be able to use an Object, but I get an error: Public Property FieldValue([vFieldID As Object = -1]) As Object cannot be exposed to COM as a property 'Let'. You will not be able to assign non-object values (such as numbers or strings) to this property from Visual Basic 6.0 using a 'Let' statement.* My

Active Directory COM Exception - An operations error occurred (0x80072020)

心已入冬 提交于 2019-12-27 17:39:27
问题 I am getting an intermittent COM Exception " An operations error occurred (0x80072020) " (shown below) when I try and query Active Directory using the method GroupPrincipal.FindByIdentity Here is my code: PrincipalContext ctx = new PrincipalContext(ContextType.Domain, Environment.UserDomainName); GroupPrincipal groupPrincipal = GroupPrincipal.FindByIdentity(ctx, IdentityType.Name, "Group to find"); I am receiving Exception: Inner Exception: System.Runtime.InteropServices.COMException

Active Directory COM Exception - An operations error occurred (0x80072020)

青春壹個敷衍的年華 提交于 2019-12-27 17:39:02
问题 I am getting an intermittent COM Exception " An operations error occurred (0x80072020) " (shown below) when I try and query Active Directory using the method GroupPrincipal.FindByIdentity Here is my code: PrincipalContext ctx = new PrincipalContext(ContextType.Domain, Environment.UserDomainName); GroupPrincipal groupPrincipal = GroupPrincipal.FindByIdentity(ctx, IdentityType.Name, "Group to find"); I am receiving Exception: Inner Exception: System.Runtime.InteropServices.COMException