Advertisement

#define WIN32_LEAN_AND_MEAN

Started by December 09, 2002 08:37 AM
17 comments, last by MickePicke 21 years, 11 months ago
What happens when you define WIN32_LEAN_AND_MEAN in your program?
quote: Original post by MickePicke
What happens when you define WIN32_LEAN_AND_MEAN in your program?


It basicly makes sure that none of the MFC overhead, which could slow down the execution of your program, is included in your project.



[Cyberdrek | the last true sorcerer | Spirit Mage - mutedfaith.com]
[Cyberdrek | ]
Advertisement
I believe it's used to exclude MFC in your windows programs, but I am not 100% sure.

EDIT: Beat me to it, bah!

Sand Hawk

----------------
-Earth is 98% full. Please delete anybody you can.


My Site

[edited by - sand_hawk on December 9, 2002 9:44:15 AM]
----------------(Inspired by Pouya)
The windows.h header doesn''t include a lot of the useless junk that you really don''t need to be using. This helps your program compile faster, because fewer lines of code are encountered for each object file that includes windows.h somehow.
Assassin, aka RedBeard. andyc.org
Thanks, so this is what you should do when the only windows code you have is to open an OpenGL window without MFC?
And these guys at Microsoft. To have a define named like this...
WIN32_LEAN_AND_MEAN has nothing to do with MFC. it just excludes stuff like GetOpenFileName() funcs and ShellApis
[s]--------------------------------------------------------[/s]chromecode.com - software with source code
Advertisement
Defining WIN32_LEAN_AND_MEAN excludes rarely used stuff from your program. It makes your program compile faster by excluding these rarely used things. Not sure what it excludes, to be honest, though I''ve never run into any problems so I suppose it''s mostly stuff for "advanced" users (like advanced thread management or "direct" hard disk management? Dunno...)
quote: Original post by Cyberdrek
It basicly makes sure that none of the MFC overhead [...] is included in your project.

windows headers don''t have any declarations or definitions that are part of mfc.
quote:
[...] which could slow down the execution of your program [...]

that define has no effect on runtime performance or exe size, assuming an optimizing compiler and release build. it merely speeds up compilation.

next time, get your facts straight before posting.
I checked the VC++ 6.0 helpfile and had it refer me to Windows.h, that header then gave me this code:

    #ifndef WIN32_LEAN_AND_MEAN#include <cderr.h>#include <dde.h>#include <ddeml.h>#include <dlgs.h>#ifndef _MAC#include <lzexpand.h>#include <mmsystem.h>#include <nb30.h>#include <rpc.h>#endif#include <shellapi.h>#ifndef _MAC#include <winperf.h>#if(_WIN32_WINNT >= 0x0400)#include <winsock2.h>#include <mswsock.h>#else#include <winsock.h>#endif /* _WIN32_WINNT >=  0x0400 */#endif#ifndef NOCRYPT#include <wincrypt.h>#endif#ifndef NOGDI#include <commdlg.h>#ifndef _MAC#include <winspool.h>#ifdef INC_OLE1#include <ole.h>#else#include <ole2.h>#endif /* !INC_OLE1 */#endif /* !MAC */#endif /* !NOGDI */#endif /* WIN32_LEAN_AND_MEAN */    


Or: Check the MSDN at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_Faster_Builds_and_Smaller_Header_Files.asp

-Ryan "Run_The_Shadows"
-Run_The_Shadows@excite.com
-The Navidson Record! The best film you'll never see!

[edited by - Run_The_Shadows on December 9, 2002 2:12:00 PM]
Not that I'm complaining about the effort but you've been blatently wrong on both of my GDI questions and yet you still continued to post even offering sample source which didn't work at all. Which you should have known had you actually tried it before passing it off as working source. It's not difficult AT ALL to whip up a Win32 app, create the window and pop your source in and see that the bmBits pointer was null and hence not working.

The second one, telling me that getting information from a hidden HWND is just like getting information from a visible one you should have known was absolutly wrong with just 5 minutes of, oh I dunno, actually trying it.

So before you tell someone to get their facts straight, you ought to work on that yourself.

I'm under no inclination to believe you have any idea what "LEAN AND MEAN" does at this point. I know one of my old DX books mentioned it but it's been awhile since I've used it.

Looks like Run_The_Shadows pulled up the absolute answer from MS.

Ben


IcarusIndie.com [ The Labyrinth | DevZone | The Wall | Hosting | Tiberian Merchandise | GameShot | Fun With Cutouts ]

[edited by - KalvinB on December 9, 2002 2:15:58 PM]

This topic is closed to new replies.

Advertisement