Saturday, April 12, 2014

RegisterBlogEx()

It may seem pointless to use pure Win32 API to create new software nowadays. There are many higher-level APIs that makes developing shorter, more effective and operating system slower.
However, you can find some great software written only in WinAPI (eg. Notepad++TPFanControl or some my applications). Why did they decide to create that way? Maybe due to:


Launching speed

Apps created in pure Windows API use mostly libraries that are probably already loaded into memory, because other software uses them (and so does OS). This is the lowest-level API in Windows (well, there can be also some kind of interrupts, I guess, but highly limited in user space), so it'll be difficult to start faster something that needs external libraries.


Running performance

Access to a whole window message queue allows you to check only these you really need. What's more, operations in WindowProcedure can be finished quickly (less than "several seconds") or sent to other threads, so messages are constantly processed. That would decrease probability of "not responding" programs which is really annoying state (a least for me) – the only things you can do are: forcing to close app, watching white window with this lovely circle: 
If it's not animating, your browser sux
or going for some more coffee. Writing code in non-managed technology (like standard C++) forces you to manage memory on your own (or not – there is a lot of memory.. who cares). But this eliminates the need for extra resources (eg. threads) for garbage collector and increases performance.

Portability

WinAPI is changing quite slowly and usually preserves good backward and forward compatibility. That means, what was created many years ago under older Windows should work in much newer version without major problems. Moreover, using standard system libraries (unlike in .NOT .NET which needs huge and fat framework to be installed additionally) makes it easier to port them into other OS. The brilliant example is Wine (Linux port of WinAPI libraries that allows you to run Windows apps natively). It's so good that some software works even faster and better than in Windows..




Smaller size

No extra libraries means smaller size, that's quite obvious. But not for GNU GCC, which puts some library garbage into console applications which makes simple "Hello world" about 500KB. That's good topic for another post. For the moment, you can read this article.

When I find some more time, I'll post more weird and not obvious stuff connected with WinAPI which I've found during Windows programming.

No comments:

Post a Comment