|
-
February 11th, 2010, 06:38 AM
#7
Re: MFC Support in ATL COM Project
Hi,
If you are creating an ATL app as a DLL, then this is what your stdafx.h should look like...
Code:
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently,
// but are changed infrequently
#pragma once
#ifndef STRICT
#define STRICT
#endif
#include "targetver.h"
#define _ATL_APARTMENT_THREADED
#define _ATL_NO_AUTOMATIC_NAMESPACE
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
#include <afxwin.h>
#ifndef _AFX_NO_OLE_SUPPORT
#include <afxdisp.h> // MFC Automation classes
#endif // _AFX_NO_OLE_SUPPORT
#include "resource.h"
#include <atlbase.h>
#include <atlcom.h>
#include <atlctl.h>
using namespace ATL;
So, create a test ATL project with MFC support and you will find <afxwin.h> and <afxdisp.h> included and if you remove MFC support from the wizard, these are not included. That should get u started...
Also, when you right click on your project name in the solution explorer and go to the properties, and then navigate to the left side tree view's Configuration Properties -> General node....then on the right side you will see an option "Use of MFC". Make sure that is set to "Use MFC in a shared dll" other wise, even if you include those MFC includes in stdafx.h, compiler will not build against them.
I hope that should be it...and that is if you are using VS 2008 (9.0)...but VS 2005 is not a lot different as far as VC++ IDE is concerned
Regards,
Bhushan
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|