PC Review


Reply
 
 
George
Guest
Posts: n/a
 
      30th May 2005
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


 
Reply With Quote
 
 
 
 
George
Guest
Posts: n/a
 
      30th May 2005
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
"George" <(E-Mail Removed)> 在郵件
news:%(E-Mail Removed) 中撰寫...
> 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
>
>



 
Reply With Quote
 
Michael D. Ober
Guest
Posts: n/a
 
      31st May 2005
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.

"George" <(E-Mail Removed)> wrote in message
news:%23%(E-Mail Removed)...
> 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
> "George" <(E-Mail Removed)> 在郵件
> news:%(E-Mail Removed) 中撰寫...
> > 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
> >
> >

>
>
>




 
Reply With Quote
 
Mihai N.
Guest
Posts: n/a
 
      1st Jun 2005
> 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
 
Reply With Quote
 
New Member
Join Date: Jul 2005
Posts: 1
 
      15th Jul 2005
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


Quote:
Originally Posted by Mihai N.
> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CString link error in VC7 with MFC extersion dll which export functions using CString as parameter flyingxu@gmail.com Microsoft VC .NET 2 2nd Dec 2006 02:22 AM
Re: CString Michael D. Ober Microsoft Windows 2000 Developer 0 31st May 2005 01:18 PM
Re: CString.Right Cor Microsoft Dot NET 0 5th Feb 2004 10:53 AM
CString.Right Selen Microsoft C# .NET 3 30th Jan 2004 01:51 PM
CString.FormatMessage and CString.Format difference Hai Ly Hoang [MT00KSTN] Microsoft VC .NET 2 9th Dec 2003 08:07 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:10 AM.