One, COM server--> COM client
This is the traditional COM knowledge, if this part of the content is not clear, you can go to see Mr. Yang's personal column, where there are very good tutorials, I am not here nonsense ^_^
It does not mean that this part is not important, on the contrary, if the reader is familiar with this part, it will be found that all the subsequent content in form is almost imitating the traditional COM call.
Second, COM server-->. NET Client
Well, that's the point. The following diagram is the principle of this section. Each COM object will have a runtime callable wrapper (RCW) proxy, regardless of how many references it has.
In the absence of a public interface (or not at all)
The operation used in this case is p/invoke. At a minimum, we need to know the following two elements:
Name of DLL file
The name or sequence number of the function to be invoked;
Then you need to do the following two steps:
Identify it in a. NET program, must be static, external
C + +: extern "C"; call it like a normal function; note for parameters:
If it is a struct or class, note that internal members must be defined as public to expose
You can apply some properties to personalize, as described in the Personalization property code below, or you can use a wrapper class if you want to call a number of functions, or you want to make this function a member of a managed class:
Declare a DLL function directly within an existing class;
Makes functions isolated and easy to find, and you can create a class for each DLL function, respectively;