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

How can i implement the dynamic menus in MFC plz give the code

2 Answers  


How to handle dynamic menus in mfc? What happens when client calls cocreateinstance?

0 Answers  


Hi All, i am new for VC++ SDK. i want to get the IP Address of all the External device connected with my local machine.please give the code Regards, Praveer

1 Answers   TCS, Tech Mahindra,


what is the difference between compiling and building?

1 Answers  


plzz tell me what we can do and dont in tally ERP & sap business one?

0 Answers  






Explain Doc/View architecture

6 Answers   Huawei,


1)How to load an icon on a button as Dynamically ?

1 Answers   HCL,


List out the basic features of MFC.

4 Answers   Mphasis,


how u can move CDC pointer to one line in cview?

2 Answers  


What is stack size in win32 program?

1 Answers   HCL,


What is the difference between workrer thread and UI thread

3 Answers   HCL,


What is the difference between Synchronous sockets and asynchronous sockets?

2 Answers  


Categories