Click here to Skip to main content
15,892,537 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I was just wondering why one would learn win API now when .NET pretty much takes care of everything?

I mean the coding is a lot less complex. I was just wondering if I should bother learning win API?
Posted
Updated 26-Mar-11 9:26am
v2

1. Because it doesn't (take care of everything).

2. Because the Win32 API sits between the kernel and any framework, including .NET.
 
Share this answer
 
v2
Comments
#realJSOP 26-Mar-11 5:51am    
5 - Proposed as answer.
Sergey Alexandrovich Kryukov 26-Mar-11 15:06pm    
Not that I disagree (vote 5, too, this explain why learning it), but it is not so simple... please see my Answer.
--SA
1. Because there can be context where managed memory environments aren't suitable (and .net is managed)

2. Because there are context where you have to target many different platform (and WinAPI are similar to X-windows as to MAC native API ..., .net is all a different beast)

3. Because - respect to the underlying API, .net is inefficient and extremely bloated.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 26-Mar-11 15:08pm    
I vote 5 but not completely agree. First of all, Win32 is much more bloated than .NET. You should count "bloat per usefulness", not just grand total. Also, all this not so simple... please see my Answer.
--SA
Learning or not learning anything is entirely your choice. Yes, you can successfully develop .NET code without ever addressing to Win32 API… until you face with a problem not solvable with .NET.

Remember: every time you use P/Invoke to access Win32 API from .NET code, you loose your portability. As this is not the only source of portability limitation, using P/Invoke may or may not be a good decision.

Even in this case, you have some options. In some situation, it's perfectly OK to give up some extra feature: it it is not so critical, maybe it is not wise to sacrifice portability (especially is at the moment all your code is pure .NET). In other situations, you can leave this problems to your colleagues: not every one can have a reputation of a "Jack of all trades".

Also remember: the Microsoft plan is to abandon Windows sooner or later and move to systems which does not have Windows API or anything using its legacy; the new systems sit right on the Hardware Abstraction Layer. One such system is already created, called Singularity, see http://en.wikipedia.org/wiki/Singularity_(operating_system)[^], other systems are being developed, see http://en.wikipedia.org/wiki/Midori_(operating_system)[^], http://en.wikipedia.org/wiki/Barrelfish[^]. I know couple of Open Source OS projects bases on CLI standard: http://en.wikipedia.org/wiki/Cosmos_(operating_system)[^], http://en.wikipedia.org/wiki/SharpOS_(operating_system)[^].

So, your extensive knowledge of Win32 API may get obsolete, while .NET knowledge is still actual. Maybe, the real value is in the theoretical background rather than technical information? You need to be educated to make educated investment in your working time.

—SA
 
Share this answer
 
Comments
Hans Dietrich 26-Mar-11 15:16pm    
It will be interesting to see the migration path for current applications to the post-Windows OS (for brevity I will simply refer to this as POS). Microsoft has to walk a fine line here; if they piss off too many app vendors, the vendors will simply switch to Linux. I have already had several clients talk to me about switching to Qt, because they don't trust Microsoft's plans for the POS. A few years ago, I would have said that not even Microsoft is that stupid; now, I think Ballmer has proven to everyone that he is in fact even stupider. So it will be interesting. Fortunately, I've done a lot of Unix work, so what happens with the POS doesn't matter to me.
Sergey Alexandrovich Kryukov 26-Mar-11 18:42pm    
Thank you for your notes, Hans.

There are two different parts: ECMA (also ISO) standard on CLI and all the rest. What is a standard of fully supported by Open Source and will be supported. Some of the rest is a candidate. Did you pay attention that Microsoft did a lot to distance from Windows? For example, if you look at WPF, it is nearly completely abstracted from Windows.

What happens is real life with Microsoft is of course a concert, but whatever happens, Windows gonna die, by one reason or another ("political" (voluntary) or "natural" way). Ballmer is... yes.

I work with Linux as well and develop something, too, but Qt and other stuff is somewhat behind the best UI (even though many things are better then Windows right now). Windows has been a polygon for best technologies but it did not help Windows itself, the problem of Windows not the lack of something, but something opposite: system is overwhelmed with crap, so it cannot normally develop anymore under this weight.

As heavy legacy is a problem with Unixes, too, including Linux, I more hope for fresh approach. I've done some system programming myself (I'm the author of very early multithreading system at the time when multithreading was not yet introduced in Linux; it included structural exception handling when it was not available in C++ (but was in Ada); and I did it from scratch on CPU level), so I have a pretty good idea on what's inside :-)

(Years ago, there was a long article in the BYTE Magazine under a long name, something like that: "Industrial PC standards are like hot dogs: it you know what's inside you never buy one" :-)

Best,
--SA
Hans Dietrich 26-Mar-11 19:25pm    
Thanks for the discussion. It sounds like you keep up with this stuff. Why don't you write an article that discusses possible future post-Windows OS's?
Sergey Alexandrovich Kryukov 26-Mar-11 21:41pm    
Well, because there is nothing about it that would be my creative contribution...
--SA
jasonterry1 26-Mar-11 18:26pm    
Yea i'm just not coming across a lot of winAPI projects and every windows PC comes with .NET thats the reason that got me wondering what the point was even learning. i played around with it a little bit and really thought the coding was too verbose just to achieve a little bit

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900