what is the use of CWinApp class?

Answers were Sorted based on User's Feedback



what is the use of CWinApp class?..

Answer / gowri shankar

CWinApp is an application object provides member functions
for initializing your application (and each instance of it)
and for running the application.

Each application that uses the Microsoft Foundation classes
can only contain one object derived from CWinApp. This
object is constructed when other C++ global objects are
constructed and is already available when Windows calls the
WinMain function, which is supplied by the Microsoft
Foundation Class Library. Declare your derived CWinApp
object at the global level.

When you derive an application class from CWinApp, override
the InitInstance member function to create your
application's main window object.

In addition to the CWinApp member functions, the Microsoft
Foundation Class Library provides the following global
functions to access your CWinApp object and other global
information:

•AfxGetApp Obtains a pointer to the CWinApp object.

•AfxGetInstanceHandle Obtains a handle to the current
application instance.

•AfxGetResourceHandle Obtains a handle to the
application's resources.

•AfxGetAppName Obtains a pointer to a string containing
the application's name. Alternately, if you have a pointer
to the CWinApp object, use m_pszExeName to get the
application's name.

Is This Answer Correct ?    18 Yes 2 No

what is the use of CWinApp class?..

Answer / rck

It is used for providing application base address and for resource handling functions.

Is This Answer Correct ?    2 Yes 2 No

what is the use of CWinApp class?..

Answer / ctharam

The base class from which you derive a Windows application object.

class CWinApp : public CWinThread

When you derive an application class from CWinApp, override the InitInstance member function to create your application's main window object.


1) AfxGetApp Obtains a pointer to the CWinApp object.

2) AfxGetInstanceHandle Obtains a handle to the current application instance.

3) AfxGetResourceHandle Obtains a handle to the application's resources.

4) AfxGetAppName Obtains a pointer to a string containing the application's name. Alternately, if you have a pointer to the CWinApp object, use m_pszExeName to get the application's name.

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More MFC Interview Questions

Does the application have more than one object? If Yes, Briefly explain.

2 Answers   Soltius Infotech,


What is the difference between ASSERT and VERIFY?

2 Answers  


How can i change the color of a dropdowncombobox elements

2 Answers  


What is the use of CCmdTarget ?

4 Answers  


What are the special requirements for dialog box resources used in a form view?

2 Answers  






How to update all the views whenver document got updated ?

1 Answers  


What interface must be supported by an ActiveX control?

2 Answers  


What four types of properties are supported by an ActiveX control?

1 Answers  


what is the use of Mutex and critical section

2 Answers  


How to handle dynamic menus in MFC?

3 Answers   HCL,


What does mfc stand for?

0 Answers  


What is subclassing?

2 Answers  


Categories