Take the 2-minute tour ×

I'm a starter C and C# programmer, mainly developing for the Windows platform (XP and above). My programs are quite small tools with GUI, so I'm currently using WinAPI for writing them. I like WinAPI for giving me almost full control over my programs, and I spend a lot of time on learning it. I asked myself if my knowledge of WinAPI is worth my time spent on learning it (I mean, if I'll be able to use this knowledge later as I'm a future developer), but I couldn't find an answer.

I would use .NET Framework, but then Windows XP users will be forced to install huge .NET Framework package just for running some small tools. I don't really like that.

So, are there still are some areas where WinAPI is at least good way to go? Would it be better not to spend my time on learning it now and stick with .NET?

share|improve this question
Just about everybody running XP already has .net installed. If you want a productive framework with no runtime installation required, look at Delphi. –  David Heffernan Apr 23 '11 at 19:53
@David Heffernan, that really depends on a certain XP user's needs. I never install .NET Framework on XP unless I get an application that requires it, and unfortunately there definitely are a lot of users who doesn't even know about .NET. Thank you for the suggestion, I'll try Delphi! –  Joulukuusi Apr 23 '11 at 19:58
@Angel It doesn't matter whether or not users know about .net. The reality is that a large proportion of XP users will have installed something else that depended upon .net. Anyway, Delphi is a very efficient tool for producing GUI programs. –  David Heffernan Apr 23 '11 at 20:00
Using a language that generates native code doesn't really solve that problem. You actually have to install Windows to run a Windows program. 3.2 gigabytes for Win7. It does have .NET pre-installed. But not the C/C++ runtime libraries. –  Hans Passant Apr 23 '11 at 20:47
Well, why don't you assume that they have .NET installed as well? 90% of all Windows machines have it. If you want to find a good reason to learn native winapi programming then you don't need an excuse like that. Reference: hanselman.com/blog/… –  Hans Passant Apr 23 '11 at 21:06

5 Answers 5

up vote 1 down vote accepted

First of all, let me ask you a question:

Why do you think that you need full control of everything when coding GUI apps? I do not see the point? Windows users expects GUI applications to look as windows GUI applications. No need to have full control then.

imho there are no justifications to do everything yourself instead of using an existing framework like MFC or .Net. You can still get control if you like, but for most of the time you don't have to.

Best of all: You can do everything in a fraction of the time compared to doing everything by yourself.

share|improve this answer
I believe full control gives a performance boost, probably not too significant in my current applications, but important in bigger projects. Can you please explain what did you mean in your last phrase? My English isn't that good for being sure I understood it right. Thank you! –  Joulukuusi Apr 23 '11 at 20:23
about the performance boost: it's premature optimization. Can you prove that the performance boost is necessary? Else it's just a waste of time (and therefore money). The last sentence: I've rephrased it. I meant that frameworks lower the development time quite much compared to doing everything by yourself. –  jgauffin Apr 23 '11 at 20:39
For example, one my application that I formerly wrote in C# was taking about 1-3 seconds for a "cold start". When I rewrote it in C, it started to launch times faster. But yes, I'm worried about mentioned possible time and money wasting. Thank you for the editing the last sentence, now I understand you. –  Joulukuusi Apr 23 '11 at 20:48
Do your clients restart your application so often that 3 seconds becomes a problem? I've coded my fair amount of applications in both C++ and C#. I would never switch back. a) .Net applications can be quite efficient too. b) Hardware is so much cheaper than a skilled developer. –  jgauffin Apr 23 '11 at 20:52
Your welcome :) A side note: A longer start up time for a .NET app doesn't necessarily mean that it will run slower. One example is that a .NET app can be optimized for the running CPU architecture (since it's compiled when started) compared to a native app which has to be compiled for the oldest CPU architecture it should support. –  jgauffin Apr 23 '11 at 21:06

Knowledge is rarely useless. Learning the Windows API might not be directly applicable to many jobs (in relation, say, to MFC or .NET knowledge), but understanding how things work at the API level is valuable.

If you're looking for marketable skills, .NET and MFC knowledge are certainly more in demand than raw Windows API, so developing those skills will probably give you a wider range of potential employers. But then, you have a lot more competition, too.

Windows API knowledge is less common, meaning that there is less competition for those jobs, but also there are fewer employers.

For a first programming job, it's easier to get hired if you go with the crowd--develop skills that are most in demand. Once you have work, you can use your spare time on stuff you find interesting.

That's what I did, years ago. I got a job writing COBOL for banks, and spend my evenings writing assembly language, C, and Pascal programs on my personal computer. It took time, but eventually I got a job doing the kind of work I really wanted to do.

share|improve this answer

Yes. All the windows stuff in .net is just a wrapper for the windows API. If you know what you're doing in Win32 and GDI then you'll find a lot of the .net GUI stuff is very familiar and easy to pick up. And better yet, unlike a lot of "pure" .net programmers, you'll have a much better understanding of what is actually happening under the bonnet, which can be very handy sometimes.

Don't worry about Windows XP - Microsoft themselves only support SP3 now, and more or less only for critical security flaws. There have been two newer OS generations since then, so it's reasonable to support Win7 and just tell XP users they need some prerequisites to run your application. If you can find a WInXP user who doesn't have .net installed already, that is. If that makes you feel too guilty, one aproach that can help is to target .net 2.0 to save users having to upgrade to .net 3.5 or 4.0.

So, no, I don't think that learning Win32 API is a waste of time at all.

However, on the flip side, there is a lot more in .net, which can save you a lot of time and effort writing your applications. A lot of things that in Win32 require loads of work by yourself or integration of disparate 3rd party libraries can be achieved with a few lines of code in .net - this can be rather liberating.

share|improve this answer
Winforms are pretty much just wrappers for WinAPI, this isn't true for WPF though. –  svick Apr 23 '11 at 20:04

Using the higher level C#/.NET tools can be really useful for decreasing the development times of most applications, but as all higher level tools you sacrifice low level control. So depending on if speed is more or less important than precision and control will dictate in the WinAPI or .NET tools would be better suited for your needs. That being said, it should be noted that .NET can invoke the WinAPI C libraries by use of the P/Invoke functionality. You can use the P/Invoke wiki to show you the proper ways to make the calls to the WinAPI calls, but bear in mind that in some situations this can be quite hairy. For whatever it's worth, I have enjoyed working with the C# language.

share|improve this answer

Angel, I'll disagree witht he above. .NET is clearly the current step in Windows development, it installs just fine on Windows XP if the Windows XP box has enough memory and performance to run XP SP3, and XP is an antique at this point. If you are just starting out, why start with antiquity?

I am ancient by programmer standards. This is my 30th year of programming professionally, starting mostly in assembler far too long ago. I've been working in Microsoft environments since DOS 1.1, so many years ago, when even the basic C environment was total garbage. First assembler and then I started working heavily in Borland's Turbo Pascal, then Borland's C++ with OWL was THE hot ticket, then Microsoft turned Vistual Studio into the best-in-class and brought out WFC and COM.

The bulk of my work has always been systems development and communications, so I've not even explored much of the regular "user application development" parts of the Windows API world, and was always very heavily involved in the core Win32 C API's. A great set of API's, but C# in .NET is so much easier and you can get so much more software done so much faster, why bother?

No one person can master all of the Microsoft API's. It's just overwhelming. Might as well start with the most current! I am a crusty old dude for a programmer, and I would not go a away from my many years programming in C and C++ directly to the Win32 API easily, but Microsoft did such a fantastic job with .NET and the C# JIT compiler that I moved over in 2002.

A big thing to me is that a programmer, a senior programmer anyway, can no longer just be a "Windows Programmer", and the world has moved to object oriented platforms like .NET and Java. C# and Java are darn near the same thing, so why not learn both. These are the platforms for the future. C# code runs on Mono on Linux, and Java runs on just about anything and is the leading environment for development for mobile devices.

Why would you limit yourself in your programming environment in order to be able to avoid having to install some libraries on a 10 year old operating system that has been obsoleted by it's vendor? Considering the a gazillion Hertz processor with multiple cores, Gigabytes of RAM, and terrabytes of storage costs a few hundred bucks these days, I don't think abandoning the few holdovers "stuck" with XP is worth you wasting your time on.

share|improve this answer

Your Answer


