Skip to content

Instantly share code, notes, and snippets.

@hkuno9000
Last active January 16, 2019 02:07
Show Gist options
  • Save hkuno9000/480beeef6b74689c8e7d3089a946c935 to your computer and use it in GitHub Desktop.
Save hkuno9000/480beeef6b74689c8e7d3089a946c935 to your computer and use it in GitHub Desktop.
How to detect MFC class in import headers
macro name | target
---------------|-------------
_AFX | MFC classes
__CSTRINGT_H__ | CString
__AFXSTR_H__ | MFC's CString
__ATLSTR_H__ | ATL's CString
#include <import.h>
#ifdef _AFX
code for MFC
#else
code for non-MFC
#endif
see:
* https://stackoverflow.com/questions/1196808/how-to-detect-use-mfc-in-preprocessor
* https://docs.microsoft.com/en-us/cpp/atl-mfc-shared/using-cstring?view=vs-2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment