Site Information Classes
Classes in ATL are classified into various classes, data types, modules, controls, etc. Site information classes are among these classifications.
Site information classes are classes that help to communicate with the object's site.
These classes are further classified into two.
-
IObjectWithSiteImpl
-
IOleObjectImpl
We will learn about the subdivision of the site information classes in detail in the next sections.
IObjectWithSiteImpl
The objective of site information classes to communicate with the object site is fulfilled by the IObjectWithSiteImpl class. This method is similar to IObjectWithSite. The only difference is that IObjectWithSiteImpl is used for objects that are not a control.
Control in ATL
The general support classes in ATL are also known as the controls. Controls are available in various classes. They help to implement the ATL library classes, such as site information classes.
Whereas IObjectWithSite is used for objects that are a control.
While using site information classes, we always inherit IObjectWithSite first, then IObjectWithSiteImpl.
It consists of members who are passed along with IObjectWithSiteImpl to access the site of objects.
It mainly requires two methods to function:
-
GetSite - to receive a site address to access in the form of a pointer.
-
SetSite - to set an IUnknown pointer for the site’s address.
NOTE: IUnknown is an interface that helps to get the pointer for the object location and access objects in ATL.
Syntax
The syntax to use site information classes as IObjectWithSiteImpl is
template <class name>
class ATL_NO_VTABLE IObjectWithSiteImpl:
public IObjectWithSite
Breaking down the syntax:
-
Declare the template library with the custom class name.
-
Declare class with ATL class name and IObjectWithSiteImpl.
- Declare IObjectWithSiteImpl as a public function inside the class.
Members
The IObjectWithSiteImpl class under site information classes can be used differently. A few global functions are added using the scope resolution operator (::). These functions act like members of the site information class. There are a total of four members, among which three are public methods and one is a public data member.

These members perform different functions to access the object's site.
The table below shows all the members, their functions, and the query to use.

IOleObjectImpl
The objective of site information classes to communicate with the object using its location/site is fulfilled by the IOleObjectImpl class. This method is similar to the method discussed above. The only difference between IOleObjectImpl and IObjectWithSiteImpl is that the former gives access to objects that are an ATL control. Whereas, the latter gives access to objects that are not an ATL control.
IOleObjectImpl consists of members that are used with IOleObjectImpl class to execute tasks with ease. These are passed along with IOleObjectImpl to access the object using the object’s location.
Controls in ATL are the support classes used to execute COM easily.
NOTE: This cannot be used for applications executed in the window’s runtime.
Syntax
The syntax to use site information classes as IOleObjectImpl is
template<class name>
class ATL_NO_VTABLE IOleObjectImpl :
public IOleObject
Breaking down the syntax:
-
Declare the template library with the custom class name.
-
Declare class with ATL class name and IOleObjectImpl.
- Declare IOleObject as a public function inside the class.
Members
The IOleObjectImpl class under site information classes can be used differently. A few global functions are added using the scope resolution operator (::). These functions act like members of the class. These members help to access site information using the control classes.
There are a total of 40 members of the IOleObjectImpl class. All of these are public methods.
The table below shows a few crucial members, their functions, and the query to be used.
Frequently Asked Questions
What are the applications of ATL?
ActiveX controls are frequently created using the Active Template Library (ATL), a wrapper library that makes COM development easier. MFC(Microsoft Foundation Class) or ATL(Active Template Library) applications may be produced with Visual Studio Community Edition or higher.
What is an MFC application?
Based on the Microsoft Foundation Class (MFC) Library, an MFC application is a Windows executable program.
What is a DTO class?
Data Transfer Objects are public classes with no methods other than the compiler-supplied default constructor, having only public (static) fields limited to easily serializable types.
What is a class data value?
Information that is shared by all the instances or aggregate information about the instances is kept in a class data value.
What are classes in ATL?
Classes in ATL contain data necessary to display to various destinations, like a printer, metafile, or ActiveX control. Classes instance data in the ATL windowing code.
Conclusion
We have discussed all the necessary information you need to start working with site information classes in ATL. We have discussed the subdivisions under site information classes in detail, along with various members of the subdivisions.
Refer to the below topics for more understanding of ATL classes:
If you want to learn and upskill yourself, the Coding Ninja has got you covered. You can refer to the open-source guide and learn about Data Structures and Algorithms, Competitive Programming, JavaScript, System Design, and many more!
Refer to our guided paths on Coding Ninjas Studio, resources on Coding Ninjas Studio, and Coding Ninjas Studio Library to learn about many more amazing topics. Also, refer to the mock test and problems available to better grasp concepts. Have a look at the interview experiences and interview bundle for placement preparations.
Happy Learning!