|
-
Apr 5th, 2003, 01:55 PM
#1
Thread Starter
Fanatic Member
MessageBox .exe is HUGE! why?
Here is my code, This program is huge, its at 104K, Is that normal? What is the smallest method to display a MessageBox with 'test' as body and 'title' as the title
Code:
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <windowsx.h>
#include <stdio.h>
int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprevinstance, LPSTR lpcmdline, int ncmdshow)
{
MessageBox(NULL,"Test","title",MB_OK);
return(0);
}
Can someone tell me what WIN32_LEAN_AND_MEAN is? and what windowsx.h is? I copied this from a really old C/C++ gaming book.
-
Apr 5th, 2003, 04:27 PM
#2
Frenzied Member
if in VC++
Menu > Build > Set Active Configuration
chose release
-
Apr 5th, 2003, 05:49 PM
#3
Plus if you're just displaying the messagebox you don't need the windowsx or stdio headers.
WIN32_LEAN_AND_MEAN removes lesser used references from the windows.h header, including winsock2 if i recall correctly. Somewhere in windows.h you'll find this:
Code:
#ifndef WIN32_LEAN_AND_MEAN
// include various other headers
#endif
Every passing hour brings the Solar System forty-three thousand miles closer to Globular Cluster M13 in Hercules -- and still there are some misfits who insist that there is no such thing as progress.
-
Apr 5th, 2003, 09:13 PM
#4
Thread Starter
Fanatic Member
Thanks!! the release worked, its 20.5K now
With ASM I get the msgbox to be about 2.5K, Can C++ do smaller than 20.5K? It is small but it is very big for just a msgbox
-
Apr 6th, 2003, 09:21 AM
#5
Frenzied Member
I think parksie's gotten some insane number, but I think thats a pretty good size. You can make a much larger program and it will still be around that size
-
Apr 12th, 2003, 04:36 PM
#6
Monday Morning Lunatic
I hit 4K which is about the smallest you'll reasonably get for a C program.
Note that this is for C, not C++. When you do C++ you have to take a lot of other things into account (when you take out the runtime library, you have to do all the class initialisation yourself, which isn't fun).
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
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
|