开发者

Sphere of application of WinAPI [closed]

开发者 https://www.devze.com 2023-02-28 02:30 出处:网络
Closed. This question is opinion-based. It is not currently accepting answers. 开发者_Go百科 Want to improve this question? Update the question so it can be answered with facts and citation
Closed. This question is opinion-based. It is not currently accepting answers.
开发者_Go百科

Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.

Closed 1 year ago.

Improve this question

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?


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.


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.


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.


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号