Home > Software engineering > How to call the third party of COM components? Need to know what information?
How to call the third party of COM components? Need to know what information?
Time:10-03
Soon after contact with COM components, according to the online tutorial using ATL templates got a COM component, create a class, add the method and register, then written in MFC executable calls to the method of COM component interface (function), running through no problem, Project requirement is that I want to be a general detection software, testing of multiple manufacturers COM component, the COM component is a specification in accordance with the industry to provide a set of function interface, the function name and parameters are fixed, each manufacturer are consistent, internal implementation, I want to use a test software, the DLL runtime choose different manufacturer, can call to the manufacturer of the COM component interface function, so first of all, each manufacturer COM DLL file name is uncertain, # import * * * *. DLL no_namespace here to see if there is trouble? Manufacturers and, more importantly, the COM components in the name of the class are not sure, can't import when writing a test software, the Internet search the invocation of the method are: CLSIDFromProgID (OLESTR (" myCom GetRes "), & amp; Clsids); CComPtr PGetRes;//the practical situation of smart Pointers IGetRes uncertain PGetRes. CoCreateInstance (clsids); PGetRes - & gt; Hello ();
ProgID information such as perhaps check, the test program is running in, but IGetRes this class interface name test program compile time is set, the runtime can't change, If each manufacturer COM component class interface name, file name is unknown, that this way is ok? How should the dynamic invocation?