5

I need to write a Windows XP/Vista application, main requirements:

  • Just one .exe file, without extra runtime, like Air, .Net; posstibly a couple of dlls.
  • Very small file size.

The application is for network centric usage, similar to ICQ or Gtalk clients.

2
  • Is the small file size that important? These days for a desktop app there isn't much meaningful difference between an EXE that is 10kb and one that is 1mb. Even on dialup you can download that in a couple of minutes, and zipping it gives you even more leeway. Unless it's just as a challenge :) May 5, 2010 at 16:36
  • Just for clarification: does it need to be non-memory-hungry?
    – syockit
    Mar 7, 2011 at 1:22

14 Answers 14

9

I would use Delphi and have a look at this. Delphi compiles into a single file executable, is easy to learn (object pascal), has a nice IDE and one of the fastest compilers available. And if you get Turbo Delphbi 2006, it is even free!

2
  • Malach, that doesn't actually work. The executable is decompressed in memory and executed by the "wrapper" application, effectively increasing its original memory footprint. That, and anything accessed in a local path from the application could be screwy if it gets stored in a different location. You're better off learning ASM.
    – Robert K
    Jun 13, 2009 at 13:32
  • Turbo Delphi 2006 is no longer available.
    – JasonFruit
    Oct 16, 2010 at 22:42
9

You can try: C++ w/ MFC. That's really going to be the only way you can seriously control the 'size' of your application (though why is that a constraint?).

If you want even lighterweight, you can try the Windows Template Library with C++.

4
  • MFC is evil. It's horrible to code in. I'm downvoating myself.
    – the_drow
    Jun 12, 2009 at 13:52
  • 1
    The OP wanted to know about 'smallest'. Easiest to use wasn't on his list. Jun 12, 2009 at 14:05
  • I didn't downvote, but for my money "easy to use" is always a meta-requirement.
    – T.E.D.
    Jun 12, 2009 at 14:27
  • Actually, I'm upvoting because WTL looks like just what the OQ was asking for.
    – T.E.D.
    Jun 12, 2009 at 14:40
5

It depends, I think, how much UI you require. The benefit of frameworks such as MFC is it wraps a lot of boiler plate code for you. However.. if executable size & dependencies are the major constraint, it can be quite fun to build a tiny app.

It's quite possible to build a Windows application with bare essentials (a dialog, etc) and make use of common dialog resources which will already be installed (e.g commdlg.dll).

To keep it as small as possible I'd recommend writing It with C++, preferably with the MSVC runtime for ease. The Win32 API is pretty easy to pick up in terms of the essential steps, e.g. registering windows and creating a message proc.

Can you be a bit more specific with what you'd like to know more about?

5

Forget MFC if you need no runtime dependencies. WTL is lightweight.

6
  • This is what I was going to suggest, +1. WTL is great.
    – Rob
    Jun 12, 2009 at 13:28
  • You can statically link the MFC lib into the .exe. Of course, this will affect the .exe size. Jun 12, 2009 at 13:35
  • 1
    Interesting, I had never heard of WTL, but it looks interesting. Do UI elements look modern with this framework? I'm currently using pure Win32 which still looks like Windows 95.
    – AriX
    Jun 12, 2009 at 13:36
  • 1
    You have to add a manifest to your project that specifies the newer version of the commmon controls DLL. That will give your app the updated look and feel. Jun 12, 2009 at 13:39
  • 2
    WTL is what MFC would have been if it had a decent C++ compiler. Unfortunately MFC had to work around a lot of missing features and by then it was widely used an the cruft so ingrained it couldn't really be replaced. Jun 12, 2009 at 14:55
3

It depends on which language you are planning on using.

  • PowerBasic
  • Delphi
  • Microsoft Visual C++ (with or without statically linked MFC/STL/WTL libs)

All these will create a standalone .exe without the need for any runtime.

1

Though it's not really an active project anymore, I've used the V C++ Gui to write some small one-off tools in the past before I started working with Java. It's kind of an MFC-lite. But like I said, it's an inactive project now.

Does it have to be GUI? If not you could get away with using something like PDcurses to build a console application.

1

You can try HTA (HTML application) and make exe file with http://www.xneat.com/application-builder/index.htm

0
1

FLTK is another option for a fast light toolkit, it's also cross platform.
For quick an easy on Windows I would probably go with MFC, it's old and not the cleanest design but the support is built into MS tools and it's very easy to get a quick sample up and running.

ps. Using MFC with the free compiler is a bit tricky, if you only have Visual Studio express I would look at something like FLTK.

1

Just use C / Win32 api.
Unbeatable (exe < 1KB !)

1

ALthough its been mentioned, PowerBasic is very powerful, compiles fast code down to a single small exe and supports some very advanced features. It is touted as a VB6 alternative, but in many ways its more powerful and other ways it is limited, eg: no native forms/GUI but optional extras support GUI front-end development. No native form controls, but COM is supported.

Formerly known as 'Turbo Basic' (from the old Borland days) its quite cheap, but not free. Its is also a bit 'quirky' and takes some getting used to.

www.powerbasic.com

1

Well, use Assembly Language, so the EXE is NOT BLOATED (What you write is what you get)!

0

How small is very small for you? I've used MFC before and gotten sub 200k files. Though I don't know if you're OK with DLLs though.

MFC is a pretty safe bet on Windows, though it is quite old and ugly (in my opinion).

2
  • How small? Under a megabite is the best for this project.
    – user11104
    Jun 12, 2009 at 13:38
  • @T.E.D: yes, actually. But my partners saying no ;) Though it could be cool, you know kind of Finch/Pidgin way.
    – user11104
    Jun 12, 2009 at 14:57
0

Another possibility is REALBasic. It will create a native exe, but may require a couple of DLL's depending on the gui components used. The base exe file size is ~3MB, which may be too big for your needs.

-8

I do not like Windows, well I hate it. However I would use C++ and Windows API. You can download Visual C++ express for free or use Eclipse for C++.

Thanks for the -9 guys! I still hate Windows. Few serious command line programs. Primitive shell. Very closed environment. Inefficient. Insecure. Want more?

8
  • 1
    In the future I don't recommend you bash the OS that a large portion of StackOverflow users depend on for their livelyhood. -1.
    – Rob
    Jun 12, 2009 at 13:29
  • 1
    How different is that from bashing programming languages, which has been done on several other questions in this site? We depend on those for our livelihood too! I think it's because many programmers have a platonic view of what is "the best", which makes us anal and judgemental and argumentative, and I personally think this is a good thing, even when I'm on the receiving end of such banter. That said, our OP is wedded to XP, the answers here should help him make the best of things. In that light, I think his comments fit. Straight Win32 API generates compact apps. +1.
    – J. Polfer
    Jun 12, 2009 at 13:45
  • I'm also using Debian Lenny. And the first version of program is done with Adobe Air and is quite compact (1.7 Mb). But there is a runtime that should be downloaded, 17 Mb. And people (99% Windows users) won't get it through Internet yet. So market share and customer demand is king in this situation.
    – user11104
    Jun 12, 2009 at 13:49
  • 2
    @sheepsimulator, I don't think bashing programming languages in the way that rtacconi is appropriate either. It's fine to lay out arguments against something, but saying "I hate it" or "it sucks" is really not appropriate for this site.
    – Rob
    Jun 12, 2009 at 14:28
  • 1
    @unforgiven: Why not? Just because you make your living off of it doesn't mean you have to be a blind fanboi.
    – T.E.D.
    Jun 12, 2009 at 14:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.