In our previous article, we have created Type Library “Hello.tlb”. We were facing issues when we tried to add “HelloComponent.dll” as a reference to our Visual Basic test application. Hence we have created “Hello.tlb” Type Library. And we observed that even with “Hello.tlb” Type Library, Visual Basic test application (console based application) is showing error […]
COM (Component Object Model)
COM – Creating a COM Component using C++ – Generate a Type Library
We have created our COM component using C++ and we have tested our COM component in C++ based client application. We found that our COM component is working fine. Since our component is built on COM, it should work with client applications which developed using other languages like Visual Basic, Java, Visual C++ etc., This is one […]
COM – Creating a COM Component using C++ – Summary of component development
Finally we have successfully developed our COM component HelloComponent using C++. Lets summarize how we developed our COM component in this article. Microsoft’s Component Object Model (COM) is a specification to allow to write re-usable components and enables them to communicate each other. COM depends on interfaces to achieve its goals. One of the main interface is […]
COM – Creating a COM Component using C++ – IClassFactory implementation
CoCreateInstance depends on IClassFactory to create class instances. We have looked into IClassFactory‘s methods and we have implemented these methods in our previous article. Let’s include IClassFactory‘s implementation into our HelloComponent. We already have HelloComponent‘s declaration in the “HelloComponent.h” file and its implementation in the “HelloComponent.cpp” file. In the same way, we will add the IClassFactory […]
COM – Creating a COM Component using C++ – IClassFactory
In our previous article, we have identified that CoCreateFunction is requesting an instance of IClassFactory. Why CoCreateInstance is requesting an instance of IClassFactory? One of the goals of the COM is to locate the objects easily without worrying about where they are located and where they are housed; whether they are housed in in-process, local, or remote. in-process means, the […]
COM – Creating a COM Component using C++ – Inside CoCreateInstance
As we discussed in our previous articles, COM’s CoCreateInstance function is used to create instances for COM classes. What is happening inside the CoCreateInstance function? When the client program calls CoCreateInstance to create an instance of COM class: It actually internally calls another function CoGetClassObject CoGetClassObject checks the registry entries for CLSID which was passed through […]
COM – Creating a COM Component using C++ – LoadLibrary
When we run our test application, we were getting a message “No such interface supported”. It seems, CreateInstance was failed to return the instance of the component. Before looking into the way CreateInstance creates an instance of our component; let us test our DLL by calling exported functions directly without the help of COM library. To do […]
COM – Creating a COM Component using C++ – .def file
In the previous article, we have created a test application to test our COM component. When we rant our test application, it was displaying a “Class not registered” error message. Before re-looking into our component and test application code; let’s understand in what scenarios this “Class not registered” error message occurred. One scenario is, unable to find […]
COM – Creating a COM Component using C++ – Registering a COM component
In our previous article, we have packaged a component into a DLL. Now we will look at how to register the component. Registering a COM component means, adding necessary registry entries into Windows Registry. COM library will pick up the component depending on the added registry entries and create an instance of it. Because of […]