MFC Support in ATL Projects.
Posted on 2004-04-07
I have a ATL COM Object in the form of a DLL. It has a ton of interface functions and heavily uses string processing and does not process any kind of window messages and has no GUI objects.
In order to simplify string processing, I used CStrings. For which I had to enable MFC support in my ATL-COM DLL using the help of MSDN KB Article Q173974 (Add MFC Support to an ATL Project).
This article suggests the following:
Add the following line of code to the beginning of every member function of a COM interface, window procedure, and exported function:
As far as I understand, AFX_MANAGE_STATE is used so that MFC can load proper resources form the DLL in which the function recides, rather than from the EXE module.
Since I am using only the CString from MFC (and not using the CString::LoadString() anywhere in my code), do I need to include AFX_MANAGE_STATE(AfxGetAppModuleState()); in all my interface function.
In short, my question is if I am only using CString from MFC and not using any resource, do I still need AFX_MANAGE_STATE(AfxGetAppModuleState()); line in all my interface function. If the answer is "YES" why so.