Regfree COM event fails from other thread

前端 未结 1 496
长发绾君心
长发绾君心 2020-12-29 12:13

I have a COM visible .NET class which exposes events and is used from VB6. For the last couple of days I have been trying to get this to work with regfree COM, but without s

1条回答
  •  隐瞒了意图╮
    2020-12-29 12:32

    With multi-threading the calls have to be marshalled. This requires extra information, which is provided by the comInterfaceExternalProxyStub and typelib element. I had experimented with those, but did not find the right combination until now.

    Manifest changes (C# DLL)

      
        
      
    
      
      
      
      
    

    Once I was on the right track I found several pointers into the right direction. The best description I came across is below. In my example also IDispatch was used.

    Excerpt from "Registration-Free Activation of COM Components: A Walkthrough" http://msdn.microsoft.com/en-us/library/ms973913.aspx

    These elements provide information that would otherwise be present in the registry. The comInterfaceExternalProxyStub element provides enough information for type library marshalling to occur and it is appropriate for COM interfaces that derive from IDispatch (which includes all Automation interfaces). In these cases ole32.dll provides the external proxy-stub used (i.e., external to the files in the assembly). If your COM components implement only dispatch or dual interfaces then this is the element you should use.

    0 讨论(0)
提交回复
热议问题