Why is Win32 so messy?

Started by
4 comments, last by ddyer 15 years, 5 months ago
I am confused at several features of the Win32 API. 1. Why are types macroed or typedefed? (I dont think these are words:)) ex: INT, DWORD 2. Why are functions #defined from their original names? ex: typedef CreateWindowW(...) CreateWindow(...) 3. Is Microsoft ever going to replace the Win32 API with newer API? thanks... jdub
J.W.
Advertisement
Quote:Original post by jdub
Why is Win32 so messy?

its old

Quote:Original post by jdub
3. Is Microsoft ever going to replace the Win32 API with newer API?

Microsoft .NET Framework
Quote:Original post by jdub
I am confused at several features of the Win32 API.

1. Why are types macroed or typedefed? (I dont think these are words:))
ex: INT, DWORD

2. Why are functions #defined from their original names?
ex: typedef CreateWindowW(...) CreateWindow(...)

The goal was maintainability. If they ever needed to change some fundamental structure of the library, they didn't need to tell all programmers to update their code.

Quote:
3. Is Microsoft ever going to replace the Win32 API with newer API?

They already did. See .NET.


I just got ninja-ed..
Quote:Original post by jdubWhy are types macroed or typedefed? (I dont think these are words:))ex: INT, DWORD
They're typedefs to support backwards compatibility with Win16 (where an INT is a 16-bit type and a DWORD is 32 bits), forwards compatibility with Win64 and beyond, and compatibility across different compilers and so forth.

Quote:Original post by jdub2. Why are functions #defined from their original names?
ex: typedef CreateWindowW(...) CreateWindow(...)
To support porting old ANSI programs to Unicode with minimal source changes, and doing so as smoothly as possible in C. It's was also designed to allow applications both for Win16 and NT to be compiled from the same codebase.

Quote:3. Is Microsoft ever going to replace the Win32 API with newer API?
That would depend on what you mean by replace. It won't go away completely anytime soon, Microsoft is a company build on backwards compatibility after all, but over the years any number of newer APIs and wrappers have been offered for parts of Win32 (e.g. .NET and so forth.)
.NET is more of a wrapper than a replacement, at least .NET is as much of a Win32 replacement as MFC was.

oh, and the reason alot of functions have similar functions ending with W, is to facilitate unicode, when unicode is enabled, all the standard functions (like MessageBox()) are changed to things like MessageBoxW(), which is the WideCharacter(unicode) version of the function

what you have to realize is that the Win32 api was written a LONG time ago, and they were more concerned with just getting stuff to work(if you've ever seen the Windows95 bootloader code, you'd understand)how many other current api's have 15 -20ish year old design structure.

why don't they re-design their C api... 2 reasons, backwards compatability, and the fact that microsoft has completely lost touch with the reality of their market, and have resigned themselves to using their absolute stranglehold on the market to pass off products that are unimaginative, or a slight variation of their competeor's procducts

but enough with my diatribe. that being said, win32 is much more manageable than development for Mac, and to an extent Linux, IMHO
--------------------------------------Not All Martyrs See Divinity, But At Least You Tried
Actually, Microsoft has replaced their API's continuously, and never deprecated
any of the replaced APIs. That's why there is frequently a whole zoo of functions that all do approximately the same thing. The good news is that
even very old DOS programs still run. Than bad news is bloat, bugs, and a minefield of choices for programmers.

---visit my game site http://www.boardspace.net - free online strategy games

This topic is closed to new replies.

Advertisement