VC COM programming notes [July 5, 2004 14:58]

zhaozj2021-02-16  65

I have been thinking about what should I learn after these days?

Hesitate to hesitate, I want to learn, I always want to be a bigest thing. I originally wanted to give myself a website, JDK installed, Tomcat installed, Java knowledge is not enough, everything needs to start from scratch. Yesterday evening, I suddenly wanted to organize some of the zero bank business knowledge learned in the company with COM, and I participated in the company's project (the company used BCB), but the truly what I learned is not much, really realistic Said that I have learned it. More mainly in the process of implementation, there will be a lot of problems, solve the problem, is the best way to learn.

There is already a little idea of ​​com, the real COM component has not been done, and it is still very troublesome. From now on, the problem encountered by the whole process is written here:

1. Derived objects from multiple interfaces, plus them in the derived list

Public IDispatchImpl

Suppose the two interface itemplcollection, ibankcollection is derived from idispatch, and you need to change COM_ITERFACE_ENTRY (Idispatch) in COM_MAP.

COM_INTERFACE_ENTRY2 (iDispatch / * parent interface * /, itemplcollection / * one of the sub-interfaces * /)

The purpose of this is to select the path when querying the IDispatch interface.

2. How to generate an interface that doesn't need to realize the class, write directly? ? That you have to generate a serial number yourself with the GUID tool. Insert ATL Object with VC, then delete CPP and H files, compile errors, and don't know how to solve it. It seems to be generated interface. If you must derive it from it, the interface function must be realized, depressed.

3. Interface template problem, want to be a collection interface that is useful to most of the interface, such as:

There is an ipersoncollection interface, a function add (iPerson * person) if made into a template, all the interfaces, what iPerson, IANIMAL can put in this add to the interface, naturally the IDL file needs to be reflected

It seems that the template class is needed to add a template class in the object class or it is easy, but if you want to use an Add (Ixxx * PXXXX) ixxx is any one of the interface, how to use the template on this Add function, mainly How to write in the IDL file. Thinking of a method is Add (iDispatch * pdisp), but this time you have to convert it to iDispatch is more troublesome.

Post: Find an example of a COM template, it seems to have a big difference with class template, research research --ATL Source code: TemplateInterface_src

Http://www.vckbase.com/code/listcode.asp?mclsid=17&sclsid=1703&page=7

4. Access the data of another interface in the same component

IA has a function of the INT A, IB, Removea (INT A), and has a Vector

M_Vector is a list of ccomvariant, how can I remove the node of IA: A = a in M_Vector correctly? Now the key is to have IA * PA; I want to get his a value, use PA-> a error, saying that A is not a member of PA, what is going on. Do you have to turn into a COM object, how do you do it?

转载请注明原文地址:https://www.9cbs.com/read-17192.html

New Post(0)