CString

  • Thread starter Thread starter George
  • Start date Start date
G

George

Dear All,

I'm writing a DLL (no user interface) and would like to use CString in one
of my procedures. But somehow CString is not defined. I checked MSDN help
and it says to include <afx.h>. But I got the following error message:

c:\program files\microsoft visual studio\vc98\mfc\include\afxv_w32.h(14) :
fatal error C1189: #error : WINDOWS.H already included. MFC apps must not
#include <windows.h>

What should I include (or in what order) to make CString defined? Any help
is greatly appreciated.

Best regards,
George
 
Dear All,

I'd like to add one addition. The DLL I'm writing is Win32 DLL. If I'm using
MFC AppWizard(dll) to create a DLL, then it's no problem.

Thanks,
George
 
CStrings are part of MFC. In order to use CString (and the other nice
features of MFC such as dynamic arrays), you need to create your app as an
MFC dll.

Mike Ober.
 
CStrings are part of MFC. In order to use CString (and the other nice
features of MFC such as dynamic arrays), you need to create your app as an
MFC dll.

You have to set the project to use MFC (in static lib or shared dll).
This is not the same as making your DLL a MFC DLL.

After VC6, CString is also part of ATL.
You can create a generic DLL, include atlstr.h and set the project to use
ATL, static or dynamic.

Mihai
 
Dear all,
I met the similar case, need your help :
I wrote a MFC Dll and I can use the dll in my MFC App successfully. but when I try include it in a service project, compile the service will get the error: c:\program files\microsoft visual studio\vc98\mfc\include\afxv_w32.h(14)> > fatal error C1189: #error : WINDOWS.H already included. MFC apps must
not #include <windows.h>

How should use the mfc dll in the service???.

Really Appreciate your replies!
PhoebeYu


Mihai N. said:
> CStrings are part of MFC. In order to use CString (and the other nice
> features of MFC such as dynamic arrays), you need to create your app as an
> MFC dll.


You have to set the project to use MFC (in static lib or shared dll).
This is not the same as making your DLL a MFC DLL.

After VC6, CString is also part of ATL.
You can create a generic DLL, include atlstr.h and set the project to use
ATL, static or dynamic.

Mihai

--
Mihai Nita [Microsoft MVP, Windows - SDK]
------------------------------------------
Replace _year_ with _ to get the real email
 
Back
Top