Member Functions in CCOMCompositeControl Class
A class member function is a function that, like any other variable, has its definition or prototype within the class definition. It can access all class members for that object and can operate on any object.
Member functions in CCOMCompositeControl Class are defined below.
1. CComCompositeControl::AdviseSinkMap: The composite control's hosted controls can all be advised by calling this method.
Syntax of the above method is-
HRESULT AdviseSinkMap(bool bAdvise);
In the above syntax, parameter bAdvise, If all controls should be advised, then true; otherwise, false.
The method CComCompositeControl::AdviseSinkMap return values:-
-
S_OK:- Every control in the event sink map was successfully connected to or disconnected from its event source.
-
E_FAIL:- Not every control in the event sink map could be successfully connected to or disconnected from its event source.
-
E_POINTER:- This error typically denotes a problem with a template argument used in an IDispEventImpl or IDispEventSimpleImpl base class or a problem with an entry in the control's event sink map.
-
CONNECT_E_ADVISELIMIT:- The connection point can no longer accept any more connections because it has already reached its capacity.
-
CONNECT_E_CANNOTCONNECT:- The interface that this connection point requires is not supported by the sink.
- CONNECT_E_NOCONNECTION:- A valid connection is not represented by the cookie value. This error typically denotes a problem with a template argument used in an IDispEventImpl or IDispEventSimpleImpl base class or a problem with an entry in the control's event sink map.
2. CComCompositeControl::CalcExtent: This method is used to determine the dialogue resource's size in HIMETRIC units as the host for the composite control; call this method.
The syntax of the above method is-
BOOL CalcExtent(SIZE& size);
In the above syntax, parameter size is a pointer to a SIZE structure that this method should fill.
The method CComCompositeControl::CalcExtent returns the method's value as true If a dialogue box is hosting the control; otherwise false.
3. CComCompositeControl::Create: The control window for the composite control is created by calling this method.
The syntax of the above method is-
HWND Create(
HWND hWndParent,
RECT& /* rcPos */,
LPARAM dwInitParam = NULL);
In the above syntax, the parameter hWndParent, is used to handle the parent window of the control, and rcPos is used for the reserved purpose.
The method CComCompositeControl::Create returns an access point for the recently made composite control dialogue box.
4. CComCompositeControl::CreateControlWindow: Call this method to create the control window and advise any hosted controls.
The syntax of the above method is-
virtual HWND CreateControlWindow(
HWND hWndParent,
RECT& rcPos);
In the above syntax, the parameter hWndParent, is used to handle the parent window of the control, and rcPos is employed to manage the control's parent window.
5. CComCompositeControl::SetBackgroundColorFromAmbient:- This method uses the container's background color to set the composite control's background color.
The syntax of the above method is-
HRESULT SetBackgroundColorFromAmbient();
The above method returns an error HRESULT on failure and S_OK on success.
6. CComCompositeControl::m_hbrBackground: It is a data member which brushes the background.
The syntax for the data member is:-
HBRUSH m_hbrBackground;
7. CComCompositeControl::m_hWndFocus: It is used to manage the handle of the window that currently has focus.
The syntax of the data member is:-
HWND m_hWndFocus;
8. CComCompositeControl::CComCompositeControl: It is a constructor which is used in composite controls classes.
The syntax of the constructor is:-
CComCompositeControl();
9. CComCompositeControl::~CComCompositeControl: It is a destructor used in composite controls classes.
The syntax for the destructor is:-
~CComCompositeControl();
Frequently Asked Questions
What is a class description of CComCompositeControl?
It creates ActiveX control classes based on dialogue resources by serving as their base class. These controls may include additional ActiveX controls.
What does Active Template Library mean?
The Active Template Library is a collection of Microsoft C++ template classes (program routines) that are specially made to make it easier to code and develop for the Component Object Model (COM) and ActiveX.
What are C+ templates?
In C++, templates are an effective tool for passing data types as parameters to generalized functions.
What are some ATL applications?
The Active Template Library (ATL), a wrapper library that facilitates COM development, is frequently used to create ActiveX controls. Applications written in MFC or ATL can be made using Visual Studio Community Edition or higher.
What does Windows' COM object mean?
The Microsoft Component Object Model is a distributed, object-oriented method for creating binary software components that can communicate (COM).
Conclusion
Congratulations on finishing the blog! We have discussed the composite controls classes in the active template library. Further, we have discussed various member functions in composite controls classes.
This blog has helped to enhance your knowledge of the composite controls classes in the active template library. Do not stop learning! We recommend you read some of our articles on the Active template library:
1. Service provider support classes
2. Object safety classes
3. Running Object classes
Refers to our Guided Path to upskill yourself in DSA, Software Engineering, Competitive Programming, JavaScript, System Design, and many more! If you want to test your competency in coding, check out the mock test series and participate in the contests hosted on Coding Ninjas Studio!
But you have just started your learning process and are looking for questions from tech giants like Amazon, Microsoft, Uber, etc. For placement preparations, you must look at the problems, interview experiences, and interview bundles.
We wish you Good Luck!
Happy Learning!