Question about _WINDOWS in Visual C++ 32-bit edition 
Author Message
 Question about _WINDOWS in Visual C++ 32-bit edition

Hi,

I used to be a C++ programmer working on UNIX platform.  
Currently I
am maintaining a 32-bit application using Visual C++, MFC
stuff.  In
the project settings, C/C++ preprocessor definition is
"WIN32,_DEBUG,_WINDOWS,_AFXDLL,_MBCS".  But in MSDN, I
find the
following information:

"Visual C++, 32-bit edition, does not target 16-bit MS-DOS
or 16-bit
Windows executables, and therefore some macros are no
longer defined."
and "Visual C++, 32-bit Edition does not define _WINDOWS,
_WINDLL, and
..."

My questions are:
1) Shall I remove _WINDOWS from the project settings since
32-bit VC++
doesn't define _WINDOWS?
2) Currently the project can be compiled with warnings.  
The project
is running on NT4.0.  It may be ported to Windows2000 in
the future.
Will _WINDOWS setting in a 32-bit application cause any
potential
problem in the future?

Thank you in advance,

Carol



Tue, 30 Dec 2003 21:06:25 GMT  
 Question about _WINDOWS in Visual C++ 32-bit edition
Quote:
> "Visual C++, 32-bit edition, does not target 16-bit MS-DOS
> or 16-bit
> Windows executables, and therefore some macros are no
> longer defined."
> and "Visual C++, 32-bit Edition does not define _WINDOWS,
> _WINDLL, and

This means only, that the defines are not done automatically...
See: Q65472: INFO: Predefined Identifiers in Microsoft C and C++

Quote:
> 1) Shall I remove _WINDOWS from the project settings since
> 32-bit VC++
> doesn't define _WINDOWS?

Normally you do not need it (if it is not used in your program). But you can
also leave it... it does not matter (because no VC-Include-files uses it for
Win32-Apps)

Quote:
> is running on NT4.0.  It may be ported to Windows2000 in
> the future.

What do you mean with "ported". If it is running under NT it should also run
under 2000 without any problems (if you do not some hacks..)

Quote:
> Will _WINDOWS setting in a 32-bit application cause any
> potential
> problem in the future?

In the future there is a new define: _WIN64

Greetings
  Jochen



Tue, 30 Dec 2003 21:31:56 GMT  
 Question about _WINDOWS in Visual C++ 32-bit edition

Quote:
>>    because no VC-Include-files uses it for Win32-Apps

        Not true..

            dbcsstr.h  still uses _WINDOWS

Cheers
Check Abdoul
------------------


Quote:
> > "Visual C++, 32-bit edition, does not target 16-bit MS-DOS
> > or 16-bit
> > Windows executables, and therefore some macros are no
> > longer defined."
> > and "Visual C++, 32-bit Edition does not define _WINDOWS,
> > _WINDLL, and
> This means only, that the defines are not done automatically...
> See: Q65472: INFO: Predefined Identifiers in Microsoft C and C++

> > 1) Shall I remove _WINDOWS from the project settings since
> > 32-bit VC++
> > doesn't define _WINDOWS?
> Normally you do not need it (if it is not used in your program). But you
can
> also leave it... it does not matter (because no VC-Include-files uses it
for
> Win32-Apps)

> > is running on NT4.0.  It may be ported to Windows2000 in
> > the future.
> What do you mean with "ported". If it is running under NT it should also
run
> under 2000 without any problems (if you do not some hacks..)

> > Will _WINDOWS setting in a 32-bit application cause any
> > potential
> > problem in the future?
> In the future there is a new define: _WIN64

> Greetings
>   Jochen



Wed, 31 Dec 2003 00:05:57 GMT  
 Question about _WINDOWS in Visual C++ 32-bit edition

Quote:
> >>    because no VC-Include-files uses it for Win32-Apps

>         Not true..

>             dbcsstr.h  still uses _WINDOWS

You are almost correct... If you do a file-search, then you will find the
dbcsstr.h...

But if you look at the file you will find the following situation:

#if defined(_NTWIN) || defined(_NTCONSOLE) || defined(WIN32)
// .. 1st code...
#elif (defined(_DOS) || defined(_WINDOWS)) && !defined(_OS2)
// .. 2nd code...
#elif defined(_OS2)
// .. 3rd code...
#else
#error not defined _DOS, _OS2, or _NTWIN
#endif

If you create a project with VS5/6 the macro_WIN32 is always defined (if you
use windows.h, then WIN32 is also defined), regardless if you defined it in
your project settings or not.

For this reason, the "1st code" will always be used, and for this _WINDOWS
is never needed. If it is defined or not it doesnt care...
If WIN32 is not defined, you cant use many of the windows functions
correctly.

Greetings
  Jochen

PS: You can check this by compiling the following code:

#include <windows.h>

void main(void)
{
#ifdef _WINDOWS
#pragma message("_WINDOWS is defined")
#endif

#ifdef _WIN32
#pragma message("_WIN32 is defined")
#endif

#ifdef WIN32
#pragma message("WIN32 is defined")
#endif

Quote:
}



Fri, 02 Jan 2004 14:20:44 GMT  
 Question about _WINDOWS in Visual C++ 32-bit edition
I think it is used to make it compatible with old 16 bit applications. You
need not delete it.
Generally speaking, if the program can run on NT 4.0, it will run on Win2K.
_WINDOWS won't cause any problems later.

yhhuang
ICQ:91074870



Sat, 03 Jan 2004 14:20:33 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Question about _WINDOWS in Visual C++ 32-bit edition

2. 16 Bit interrupts and 32 Bit Visual C++

3. SOS!! 32-bit inline assembly in Visual C++

4. 32-bit in Visual C++ ?

5. US-TX-Richardson SOFTWARE DEVELOPERS, C++, Visual Studio, NT 32-bit commercial software

6. 32-bit C/C++ & Fortran compilers question

7. 32-bit VC 2.2 DLLs with 32-bit VB4

8. top 32 bits of 64-bit product of two 32-bit integers

9. Thunking/32 bit child window in 16 bit parent app

10. Linking 32 bit VC++4.2 DLLs with VB4.0 32 bit

11. Mixed 16-bit, 32-bit programming question

12. Mixed 16 bit, 32 bit programming question

 

 
Powered by phpBB® Forum Software