CodeSteps

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

Visual C++

Visual C++

Visual C++ – Creating an ATL COM Component (Part – 1)

Active Template Library (ATL) is a lightweight library used to develop COM-based components using Visual C++. Through ATL we can quickly develop COM components or COM services. In this article, I am trying to explain the steps to create an ATL COM component using Microsoft Visual C++ and Microsoft Visual Studio 2012 IDE (Integrated Development […]

COM – Creating a COM Component using C++ – Add Type Library to Visual Basic Application

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 – Creating a COM Component using C++ – Summary of component development

Finally, we have successfully developed our COM component HelloComponent using C++. Let’s summarize how we developed our COM component in this article. Microsoft’s Component Object Model (COM) is a specification to allow to write of reusable components and enables them to communicate with each other. COM depends on interfaces to achieve its goals. One of […]

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

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

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