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.

George Stocker
  • 57,289
  • 29
  • 176
  • 237
user11104
  • 372
  • 1
  • 3
  • 13
  • 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 :) – AshleysBrain May 05 '10 at 16:36
  • Just for clarification: does it need to be non-memory-hungry? – syockit Mar 07 '11 at 01:22

14 Answers14

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

George Stocker
  • 57,289
  • 29
  • 176
  • 237
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!

Community
  • 1
  • 1
Ralph M. Rickenbach
  • 12,893
  • 5
  • 29
  • 49
  • 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 '09 at 13:32
  • Turbo Delphi 2006 is no longer available. – JasonFruit Oct 16 '10 at 22:42
5

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

diapir
  • 2,872
  • 1
  • 19
  • 26
  • This is what I was going to suggest, +1. WTL is great. – Rob Jun 12 '09 at 13:28
  • You can statically link the MFC lib into the .exe. Of course, this will affect the .exe size. – Magnus Johansson Jun 12 '09 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 '09 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. – Peter Ruderman Jun 12 '09 at 13:39
  • @AriX, yes, it's UI elements do look modern. – Rob Jun 12 '09 at 13:47
  • 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. – Martin Beckett Jun 12 '09 at 14:55
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?

RobS
  • 9,382
  • 3
  • 35
  • 63
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.

Magnus Johansson
  • 28,010
  • 19
  • 106
  • 164
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

andora
  • 1,326
  • 1
  • 13
  • 23
1

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

CVist
  • 11
  • 1
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.

Chris K
  • 11,996
  • 7
  • 37
  • 65
1

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

dishod
  • 189
  • 1
  • 5
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.

Martin Beckett
  • 94,801
  • 28
  • 188
  • 263
1

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

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

samoz
  • 56,849
  • 55
  • 141
  • 195
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.

gbc
  • 8,455
  • 6
  • 35
  • 30
-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?

rtacconi
  • 14,317
  • 20
  • 66
  • 84
  • 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 '09 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 '09 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 '09 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 '09 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 '09 at 14:36
  • Well I do not want to go outside the topic, this is why I stated an argomentative declaration. Yes, it really suchs, Windows is unreliable, unsecure, rubbish. The antivirus suchs al lot of power, all the startup shutdown scripts scripts, crazy error the happens randomly, it takes a lot of time to boot/shutdwon. I have a PC that was a 98, with more than 80 patched to run XP!!! Cannot install XP direcly for licences issues... do I have to add more. – rtacconi Jul 15 '09 at 16:09
  • Startup and shutdown scripts ??? Where? In Windows 98???! And if you're getting "crazy random errors" please check how reliable is your cheap hardware (is your RAM working well). The NT-based Windows are pretty stable. In my experience, for example X Server is far less stable than any 2000/XP installation (and far more SLOOOOOOW)..... – Hernán Aug 16 '09 at 14:59
  • Downvoted because bashing the OS does not contribute anything to answering the poster's question. The poster explicitly stated that Windows is the target platform and asked for a comparison of languages. Feel free to discuss operating systems in questions that leave that aspect open to discussion. – Vojislav Stojkovic Feb 08 '10 at 20:10