Results 1 to 6 of 6

Thread: MessageBox .exe is HUGE! why?

  1. #1

    Thread Starter
    Fanatic Member scr0p's Avatar
    Join Date
    Oct 2002
    Location
    VA
    Posts
    720

    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.
    asdf

  2. #2
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    if in VC++

    Menu > Build > Set Active Configuration

    chose release

  3. #3
    PowerPoster sunburnt's Avatar
    Join Date
    Feb 2001
    Location
    Boulder, Colorado
    Posts
    1,403
    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.

  4. #4

    Thread Starter
    Fanatic Member scr0p's Avatar
    Join Date
    Oct 2002
    Location
    VA
    Posts
    720
    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
    asdf

  5. #5
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    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

  6. #6
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    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
  •  



Click Here to Expand Forum to Full Width