CodeSteps

Python, C, C++, C#, PowerShell, Android, Visual C++, Java ...

Author : venkat

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 […]

MFC – CObject class – Enable Object Serialization

CObject supports object serialization. One of the MFC’s great feature, which allows to store and retrieve the object’s current state. To enable this feature in our code: We must add DECLARE_SERIAL macro into our class declaration. IMPLEMENT_SERIAL macro must be added into class implementation file. And override the Serialize member function. Lets extend our class […]

COM – Creating a COM Component using C++ – .def file

In the previous article, we 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 the […]

C++ – Calling Virtual functions from class Destructors

C++ allows virtual functions to resolve function calls at run-time. This is called late-binding. Like virtual functions, C++ allows virtual destructors to delete the objects properly in an inheritance hierarchy. C++ allows calling virtual functions from class destructors. But what will happen when it calls these virtual functions from class destructors? Let’s take an example, […]

C++ – Calling Virtual functions from class Constructors

Virtual keyword in C++ is used for polymorphic behavior. C++ allows the creation of virtual functions, virtual destructors, and virtual inheritance. Virtual functions will resolve exact function calls in the inheritance hierarchy, at run-time. This is called late-binding. That means, what function to call will come to know at run-time instead of compile time. // […]

C++ – Multiple Inheritance – Virtual inheritance to overcome inheritance ambiguity

Another interesting feature of Object Oriented Programming is its inheritance. Inheritance inherits the behavior or attributes from its parent or base classes to the derived classes. C++ uses virtual inheritance to overcome the inheritance ambiguity in multiple inheritance. Multiple inheritance means, derived classes inherit from multiple base classes. Inheritance ambiguity will occur when a derived class […]

MFC – CObject class – An Introduction – Enable Run-time class information

CObject is the base class for almost all classes in Microsoft Foundation Class (MFC) library. A class is qualified as a MFC based class by deriving its from MFC’s base class CObject. Once the normal class is derived from CObject class; it inherits the following services offered by CObject class. Run-time class information Serialization support […]

Scroll to top