views:

794

answers:

13

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.

A: 

What is exactly your question?

WowtaH
He's asking for help on doing this without some sort of framework.
samoz
How can you tell ?
WowtaH
It was pretty obvious to me.
unforgiven3
Bit sad that an honest question (as a non native english speaker) gives me -2 :)
WowtaH
I'd have added it as a comment to the question.
ChrisF
Cannot comment until level 50 reputation, which i'm not getting the way this thread is going ;)
WowtaH
You didn't answer the question. Answering a question is a prerequisite for getting upvotes. Not answering the question gets you downvotes. That's the point of StackOverflow - poor answers are voted down so future users can skip over them.
unforgiven3
It's nothing personal, WowtaH - it's just how it works here.
unforgiven3
+9  A: 

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
Downvoter : No comment on why?
George Stocker
MFC is evil. It's horrible to code in. I'm downvoating myself.
the_drow
The OP wanted to know about 'smallest'. Easiest to use wasn't on his list.
George Stocker
I didn't downvote, but for my money "easy to use" is always a meta-requirement.
T.E.D.
Actually, I'm upvoting because WTL looks like just what the OQ was asking for.
T.E.D.
A: 

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
In the future I don't recommend you bash the OS that a large portion of StackOverflow users depend on for their livelyhood. -1.
unforgiven3
Sounds like a dare!
Aiden Bell
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.
sheepsimulator
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.
@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.
unforgiven3
@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.
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
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
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
A: 

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
How small? Under a megabite is the best for this project.
@bobir: Have you considered curses (http://pdcurses.sourceforge.net/)? :-)
T.E.D.
@T.E.D: yes, actually. But my partners saying no ;)Though it could be cool, you know kind of Finch/Pidgin way.
+5  A: 

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

You can call me Chuck
This is what I was going to suggest, +1. WTL is great.
unforgiven3
You can statically link the MFC lib into the .exe. Of course, this will affect the .exe size.
Magnus Johansson
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
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
@AriX, yes, it's UI elements do look modern.
unforgiven3
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
WTL is the right answer
Foredecker
+9  A: 

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!

Ralph Rickenbach
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.
The Wicked Flea
Turbo Delphi 2006 is no longer available.
JasonFruit
+2  A: 

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
A: 

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
+5  A: 

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
+1  A: 

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 Kaminski
+1  A: 

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

dishod
+1  A: 

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
+1  A: 

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