diff --git a/IB/Shared/EClientSocketBaseImpl.h b/IB/Shared/EClientSocketBaseImpl.h
index 23446b7..a2a557d 100644
--- a/IB/Shared/EClientSocketBaseImpl.h
+++ b/IB/Shared/EClientSocketBaseImpl.h
@@ -432,7 +432,7 @@ static IBString errMsg(std::exception e) {
 }
 
 
-#ifdef _MSC_VER
+#ifdef _MFC_VER
 static IBString errMsg(CException *e) {
 	// return the error associated with this exception
 	char buf[1024];
@@ -2200,7 +2200,7 @@ int EClientSocketBase::processConnectAck(const char*& beginPtr, const char* endP
 		beginPtr = ptr;
 		return processed;
 	}
-#ifdef _MSC_VER
+#ifdef _MFC_VER
 	catch( CException* e) {
 		m_pEWrapper->error( NO_VALID_ID, SOCKET_EXCEPTION.code(),
 			SOCKET_EXCEPTION.msg() + errMsg(e));
@@ -3426,7 +3426,7 @@ int EClientSocketBase::processMsg(const char*& beginPtr, const char* endPtr)
 		return processed;
 	}
 
-#ifdef _MSC_VER
+#ifdef _MFC_VER
 	catch( CException* e) {
 		m_pEWrapper->error( NO_VALID_ID, SOCKET_EXCEPTION.code(),
 			SOCKET_EXCEPTION.msg() + errMsg(e));
diff --git a/IB/Shared/StdAfx.h b/IB/Shared/StdAfx.h
index de814b7..d0e92e7 100644
--- a/IB/Shared/StdAfx.h
+++ b/IB/Shared/StdAfx.h
@@ -7,7 +7,9 @@
 #define assert ASSERT
 #define snprintf _snprintf
 
+#ifdef _MFC_VER
 #include <afxwin.h>
+#endif
 
 #endif
 
