1)why we cant create more than one instance of the class
Derived from CWinApp

Answers were Sorted based on User's Feedback



1)why we cant create more than one instance of the class Derived from CWinApp ..

Answer / shanmuga

Becoz,through the CWinApp object only ,the application
starts.. If there exist more than one object there occurs a
conflict to proceed with which object.

Is This Answer Correct ?    6 Yes 1 No

1)why we cant create more than one instance of the class Derived from CWinApp ..

Answer / narayan

You theApp object is replace with new name;

Eg

CdlgtestApp theApp;
CdlgtestApp theApp3; // now this is your applcation obj

CdlgtestApp theApp3;
CdlgtestApp theApp; // No effect

Is This Answer Correct ?    6 Yes 4 No

1)why we cant create more than one instance of the class Derived from CWinApp ..

Answer / jdp

Because the CWinApp class encapsulates the main() method
which, as you know, there can be only one instance of in
any application.

Is This Answer Correct ?    0 Yes 0 No

1)why we cant create more than one instance of the class Derived from CWinApp ..

Answer / deepesh

because in constructor of CWinApp class
if it will called twice
ASSERT(AfxGetThread() == NULL);
will cause run time assertion

Is This Answer Correct ?    0 Yes 0 No

1)why we cant create more than one instance of the class Derived from CWinApp ..

Answer / sirama

Because MFC implemented it as Singleton CWinApp::Ctor.

Is This Answer Correct ?    2 Yes 7 No

Post New Answer

More MFC Interview Questions

Which MFC function is used to display output?

9 Answers   TCS,


1) How do you Destroy a Dialog Box ?

2 Answers   Honeywell,


What function is called by a document class to notify views that the document has been changed?

2 Answers  


Explain Doc/View architecture

6 Answers   Huawei,


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

0 Answers  


Name the Synchronization objects?

2 Answers  


How to handle dynamic menus in MFC?

3 Answers   HCL,


List out the parameters of WinMain Function.

2 Answers   Mphasis,


Given two processes, how can they share memory?

2 Answers   Microsoft,


How can update edit control data of an executing application from other application?

3 Answers   HP,


Have you ever used win32 APIs ?

4 Answers   Microsoft,


What is Thread ?(VC++)What is the difference between Cmutex and Csemaphone?

5 Answers   Atos Origin,


Categories