Your question, your audience. Choose who sees your identity—and your question—with question security.
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Did you try adding namespace prefix before using CRegKey?
that is
ATL::CRegKey RegKey;
also try add #include <atlbase.h> into the your project stdafx.h