Wednesday 15 January 2014

Why is WinAPI so much different from "normal" C? -


I wonder why WinAPI is very different from "normal" C programming?

I mean, in school I have found that every program has a main () function (WinAPI uses WinMain with some special criteria), some variable types such as int, long , Char etc. (WinAPI uses things like LPCSTR, BOOL, etc.), then why Microsoft decides to go with their OS API in such a different way?

When I saw my first WinAPI program, I see it as a new language ...;)

The original Windows API was designed in the 1984-85 time frame, 25 years ago. Hungarian notation was all rage, so to declare the type of variable it was in the declaration. For example, in pure C, there is no way to point out the 'distant' indicator, which indicates LP in LPCR, but in 1985, it was very important to differentiate between regular pointers and visionaries. (This importance went from the side of the path, when a 32-bit window was inserted in the mid-90s, but the syntax remains ...)

In addition, C is actually only one indicator Does not distinguish between and a pointer to a fixed string. Thus LPS type

Finally, it is about bringing a strong, consistent typing for the parameters compared to plain C in 1984. For WinMain, this is because a Windows program is quite basic than a command line program. If you look in the library, you might find a main () function that sets the parameter and then calls a Wintern function (i.e. your).


No comments:

Post a Comment