what is the use of AFX_MANAGE_STATE ?

Answers were Sorted based on User's Feedback



what is the use of AFX_MANAGE_STATE ?..

Answer / yassar arafath.o.s

By default, MFC uses the resource handle of the main
application to load the resource template.
If you have an exported function in a DLL, such as one that
launches a dialog box in the DLL, this template is actually
stored in the DLL module. You need to switch the module
state for the correct handle to be used. You can do this by
adding the following code to the beginning of the function:
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
This swaps the current module state with the state returned
from AfxGetStaticModuleState until the end of the current
scope.

If all your resources lies in the single DLL you can even
change the default handle to the DLL handle with the help
of AfxSetResourceHandle function

Is This Answer Correct ?    21 Yes 4 No

what is the use of AFX_MANAGE_STATE ?..

Answer / rupesh bari

When building a regular DLL that dynamically links to MFC,
you need to use the macroAFX_MANAGE_STATE to switch the MFC
module state correctly. This is done by adding the following
line of code to the beginning of functions exported from the
DLL:

AFX_MANAGE_STATE(AfxGetStaticModuleState( ))

The AFX_MANAGE_STATE macro should not be used in regular
DLLs that statically link to MFC or in extension DLLs.

Is This Answer Correct ?    10 Yes 2 No

what is the use of AFX_MANAGE_STATE ?..

Answer / debasis mahapatra

When mfc42.dll is loaded as part of a process, it stores
data in some truly global variables. If you call MFC
functions from an MFC program or extension DLL, mfc42.dll
knows how to set these global variables on behalf of the
calling process. If you call into mfc42.dll from a regular
MFC DLL, however, the global variables are not synchronized
and the effects will be unpredictable.
AFX_MANAGE_STATE (AfxGetStaticModuleState ());

Is This Answer Correct ?    1 Yes 2 No

what is the use of AFX_MANAGE_STATE ?..

Answer / anonymous

None explains the question correctly.this is totally absurd
so kindly post the correct answer not wrong one damn

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More MFC Interview Questions

What is LPCTSTR? What does LP denote it?

4 Answers  


What is the base class for MFC Framework ?

4 Answers  


What is Multithreading

1 Answers   Invensys,


Explain StretchBlt and BitBlt

1 Answers  


General purpose classes in MFC

1 Answers   TCS,






What is userdefine Messages in MFC?

1 Answers   HCL,


Have you ever used win32 APIs ?

4 Answers   Microsoft,


What is the difference between Struts and JSF? Pls list some most suitable differences.

0 Answers  


I have 2 threads. One thread prints odd numbers and the second thread prints even numbers. Now, I have to execute the threads alternatively so that i can output 1,2,3,4,5,6,..... write code for this?

1 Answers  


How to update all the views whenver document got updated ?

1 Answers  


List out the basic features of MFC.

4 Answers   Mphasis,


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

0 Answers  


Categories