Allegro.cc - Online Community

Allegro.cc Forums » Off-Topic Ordeals » WinAPI.. wtf were they thinking!?

This thread is locked; no one can reply to it. rss feed Print
 1   2 
WinAPI.. wtf were they thinking!?
Goalie Ca
Member #2,579
July 2002
avatar

I've had to program in winapi recently a bit. I think a little bit of me died inside. Apparently MFC isn't much better. I've certainly coded windows.forms ala .NET and I can say its nice as long as what you need is implemented then it just ends up being P/Invoke winapi calls anyways.

So is there any reason why the most popular operating system has just an awful API. And how come.. after all this time since win95 nothing has really come along.

-------------
Bah weep granah weep nini bong!

ReyBrujo
Moderator
January 2001
avatar

WinAPI is not that bad. MFC does a good job at hiding the messages, but it is very limited and buggy. Since I prefer documentation before, I think Windows API is better than *nix syscalls or X.

--
RB
光子「あたしただ…奪う側に回ろうと思っただけよ」
Mitsuko's last words, Battle Royale

Mark Oates
Member #1,146
March 2001
avatar

This is only mildly related, but I was using OSX at school today and I realized how much better windows' interface is. Yes, you heard me right. For one, it seems like the strangest thing to seperate an application's menu from it's window. What's the benifit? And where are all my active programs... in program icons with little arrows under them? WTF is that?! Why does that stupid thing at the bottom keep stretching up everytime I get close to it? Sure, it's "cool looking" but what a annoying pain in the ass.

On top of that, no scroll wheel, no right mouse button, and super slow to boot. It took that thing almost a minute and a half to log in! These are G4's! "Fastest. Mac. Ever."... yeah

--
Visit CLUBCATT.com for cat shirts, cat mugs, puzzles, art and more <-- coupon code ALLEGRO4LIFE at checkout and get $3 off any order of 3 or more items!

AllegroFlareAllegroFlare DocsAllegroFlare GitHub

Francois Lamini
Member #7,791
September 2006
avatar

Windows sucks... that's all I can say.

Francois

Kris Asick
Member #1,424
July 2001

The Windows API is enormously complex for a very good reason: You can do just about anything with it. It's almost like a programming language in itself, and is increasingly complex due to the ability to interface with it using almost any programming language.

I actually don't like raw Windows programming at all. Developing handlers to deal with all the messages Windows can send to programs is not my idea of fun. Don't get me wrong though, it's easier than MacOS programming. (At least, for me.)

--- Kris Asick (Gemini)
--- http://www.pixelships.com

--- Kris Asick (Gemini)
--- http://www.pixelships.com

Thomas Fjellstrom
Member #476
June 2000
avatar

Quote:

is increasingly complex due to the ability to interface with it using almost any programming language.

Thats mainly due to being all C on the outside.

The Win32 API is horrendous because it was evolved over time from the original win16 apis and grew into a monstrous hair ball from hell.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Billybob
Member #3,136
January 2003

Quote:

The Win32 API is horrendous because it was evolved over time from the original win16 apis and grew into a monstrous hair ball from hell.

Indeed, but I think that's the only reason it sucks. Really, they've done the best they could without re-writing the whole thing. They can't re-write it anyway, it needs to be backwards compatible. Sad, but that's the way it goes. Luckily the documentation is good. Not great, but certainly not bad.

Thomas Fjellstrom
Member #476
June 2000
avatar

Aha, but they are rewriting it :P

I'm going to bet that Vienna will be all managed C#. Probably be wrong, but hey, gotta live a little.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Hard Rock
Member #1,547
September 2001
avatar

Quote:

I've certainly coded windows.forms ala .NET and I can say its nice as long as what you need is implemented then it just ends up being P/Invoke winapi calls anyways.

That would be because windows forms is just a high level wrapper around winapi calls. It's the last wrapper Microsoft will make, and it has had an incredibly short live span.

XAMAL and WPF are the new api (Formally WIN FX) that will soon be replacing future GUI projects. It doesn't make sense to make any large projects for windows forms since it will be killed so soon in its life cycle.

Old winapi calls will still be supported either through emulation or something or other, but new code wont be using it.

_________________________________________________
Hard Rock
[ Stars Dev Company ][ Twitter ][Global Warming: ARA My TINS 07 Entry][Pong Ultra Website][GifAllegS Ver 1.07]
"Well there's also coolwebsearch but we'll let that be an IE exclusive feature" - arielb on the New Browser Plugins "What's better, HTML or Variables?"

Goalie Ca
Member #2,579
July 2002
avatar

-------------
Bah weep granah weep nini bong!

Rampage
Member #3,035
December 2002
avatar

The WinAPI is so bad, it bullies smaller APIs and takes their lunch money.

-R

Evert
Member #794
November 2000
avatar

Quote:

For one, it seems like the strangest thing to seperate an application's menu from it's window. What's the benifit?

You always know where the menu is. I don't know, it takes getting used to, but saying it's strange just reflects not being used to it.

Quote:

And where are all my active programs... in program icons with little arrows under them? WTF is that?!

And the usability difference with the way Windows does this is...?

Quote:

Why does that stupid thing at the bottom keep stretching up everytime I get close to it? Sure, it's "cool looking" but what a annoying pain in the ass.

First thing I disabled.

Quote:

On top of that, no scroll wheel, no right mouse button,

Apple-click gives you a right mouse button. If we're talking laptops here, the touch pad beats a scrollwheel by allowing scrolling in either direction.

Yeah, I know, not really WinAPI related.

Thomas Harte
Member #33
April 2000
avatar

Quote:

For one, it seems like the strangest thing to seperate an application's menu from it's window. What's the benifit?

It's a subtle philosophical difference: in MS-Windows, applications are windows. In OS X (and early Mac OSs), applications have windows, if they want them. There is not such thing as a child window in OS X, as a result many apps run without anything being obviously the "main" window. So the most logical thing is to keep the titlebar at the top of the screen, where it has been ever since the very beginning, when the Mac didn't multitask.

Quote:

And where are all my active programs... in program icons with little arrows under them? WTF is that?!

It's called the dock. It holds both active applications and non-active applications. The black arrow tells you which ones are currently loaded. Since programs can be running without having any windows at all, it isn't otherwise obvious.

Quote:

Why does that stupid thing at the bottom keep stretching up everytime I get close to it? Sure, it's "cool looking" but what a annoying pain in the ass.

Because every application you launch gets an icon on the dock, so when you're running quite a few the icons can get very small. Therefore you can set a "minimum" size that the icons should be for when you're trying to recognise them, and the dock will scale the ones your mouse is over if they're too small. Some people set the minimum mouse-over size to be greater than the normal icon size for a "cool" effect, other people (including me) don't.

Quote:

On top of that, no scroll wheel, no right mouse button, and super slow to boot. It took that thing almost a minute and a half to log in! These are G4's! "Fastest. Mac. Ever."... yeah

Every currently shipping Mac that includes a separate mouse comes with two buttons and a scroll ball. Not a scroll wheel or a 2d rocker, an actual mini trackball that can scroll freely in any directly.

The laptops all have a trackpad that, if you want it, can do either:

  • cursor movement, if you move one finger over them

  • left click, if you tap them with one finger

  • free direction scrolling, if you move two fingers over them

  • right click, if you tap them with two fingers

The G4 was phased out of top end Macs in 2002. It was probably the lack of speed advancement in the G4 line and the inability to incorporate the G5 into a laptop form factor that made Apple switch to Intel 13 months ago.

CGamesPlay
Member #2,559
July 2002
avatar

Quote:

I can say its nice as long as what you need is implemented then it just ends up being P/Invoke winapi calls anyways.

Err, I'm pretty sure you were doing something wrong... Can you give an example?

Quote:

after all this time since win95 nothing has really come along.

They can't break API, but use your head. You just said .NET System.Windows.Forms are nice. They have come along.

Quote:

Since I prefer documentation before, I think Windows API is better than *nix syscalls or X.

I don't know about X, but all of the system calls are very well documented. Hell, they were well documented before Windows was ever invented :P

Quote:

For one, it seems like the strangest thing to seperate an application's menu from it's window. What's the benifit? And where are all my active programs... in program icons with little arrows under them? …On top of that, no scroll wheel, no right mouse button…

I agree totally. About the menu thing, though, read this. No, I don't agree with it.

Quote:

Windows sucks... that's all I can say.

Oh, put a sock in it.

Quote:

The Win32 API is horrendous because it was evolved over time from the original win16 apis and grew into a monstrous hair ball from hell.

For the most part, I agree, and I think Microsoft did as well, because they wrote System.Windows.Forms with "good design" from the ground up.

Quote:

I'm going to bet that Vienna will be all managed C#.

Is that the next operating system? They will do as much as possible in C#, but the core will always be C. I think it would be a good shift, as it modularizes the components more.

Quote:

XAMAL and WPF are the new api (Formally WIN FX) that will soon be replacing future GUI projects.

Uh, evidence? From my knowledge of the WPF, this sounds highly illogical.

Quote:

I came across this beauty tonight:

Right... Here's C#:

foreach(string f in Directory.GetFiles(@"C:\path\to\directory"))
    Console.WriteLine(f);

If you want to add error handling, it's exception-based.

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

axilmar
Member #1,204
April 2001

MFC/win32 is the most retarded API that has ever existed.

BAF
Member #2,981
December 2002
avatar

At least it's one uniform API. One of Linux's shortcomings is the lack of one API, there's a different way to do a given task depending on what software you have installed.

CGamesPlay
Member #2,559
July 2002
avatar

Quote:

there's a different way to do a given task depending on what software you have installed.

Can you give an example?

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

BAF
Member #2,981
December 2002
avatar

For example, launching a web browser or dealing with file associations. On Windows you can easily tell it to open a file with it's associated application. I'm not aware of any common way to do that on Linux.

HoHo
Member #4,534
April 2004
avatar

There isn't one yet but things are getting there. With KDE4 and Gnome both using dbus things should get quite a bit simplier. E.g two things I know are in the works is common interface for controlling media players and IM clients. Adding other things should be trivial. Of cource these things will need support from those applications but at least you can use whatever libraries you want as long as you add dbus functionality to it.

__________
In theory, there is no difference between theory and practice. But, in practice, there is - Jan L.A. van de Snepscheut
MMORPG's...Many Men Online Role Playing Girls - Radagar
"Is Java REALLY slower? Does STL really bloat your exes? Find out with your friendly host, HoHo, and his benchmarking machine!" - Jakub Wasilewski

Hard Rock
Member #1,547
September 2001
avatar

Quote:

Uh, evidence? From my knowledge of the WPF, this sounds highly illogical.

How bout the fact that there is no windows forms 3.0? They didn't bother updating windows forms but they spent time to make this new api.

Secondly if you've been to a Microsoft presentation lately, all they can talk about is how the new GUI designer is so great, and how its so great that you can call this from exisiting win api functions, etc, etc.

Finally some reading for you:
http://blogs.msdn.com/mharsh/archive/2004/09/20/231888.aspx

I know its old, but i was doing some reasearch earlier because I wanted to move my mfc project to managed C++, and trying to decide which one to go with (forms, or xaml) and I'm still not sure.

The general consensus is though, that it doesn't make sense at this point in time to start a large windows forms projects, and most companies seem to be waiting for the WPF to mature before upgrading their application. Microsoft wants to finally move from the old api, and they've done a great deal to vista to ensure that companies up their coding practices (all editable files must go in user documents(because of the next point, program files can not be modified), users are not admin by default etc etc).

_________________________________________________
Hard Rock
[ Stars Dev Company ][ Twitter ][Global Warming: ARA My TINS 07 Entry][Pong Ultra Website][GifAllegS Ver 1.07]
"Well there's also coolwebsearch but we'll let that be an IE exclusive feature" - arielb on the New Browser Plugins "What's better, HTML or Variables?"

James Stanley
Member #7,275
May 2006
avatar

Quote:

launching a web browser or dealing with file associations

Pretty sure environment variables contain what programs do what, not 100% though.

CGamesPlay
Member #2,559
July 2002
avatar

Quote:

How bout the fact that there is no windows forms 3.0? They didn't bother updating windows forms but they spent time to make this new api.

Uhm, there's no SQL Server 2007, so is WPF replacing that too?

The blog post you made was no better. So much has changed on the IE*Longhorn front since most of the features they were discussing in 2004--when the article was written--were mere brainstorms. SQL FS, anyone?

I should clarify something. Please correct me if I'm wrong, but WPF seems to have been marketed, at least in my experience, as a sort of Flash-esque replacement. That's now what you make UIs in ;)

Quote:

that it doesn't make sense at this point in time to start a large windows forms projects

the blog said:

Is it worth investing in Windows Forms?

I still think the answer is yes. But let’s break the question down by timeframe.

Is it worth investing in Windows Forms today? Yes, I still think that VS.NET 2003 provides the most efficient way to create Win32 applications.

Is it worth investing in Windows Forms next year? YES!!! Whidbey rocks. The new controls, the new designer features and the bug fixes (transparency in an ImageList, Hallelujah!) all make for a very compelling feature set from a developer perspective.

Whidbey will make creating a professional looking Win32 app as easy as it was to create hello world with VB6. And Whidbey also provides a slick deployment mechanism with ClickOnce.

Is it worth investing in Windows Forms in 2 years? This is more of a judgment call. If you’re targeting only Windows XP and Longhorn, Avalon is the way to go. But Windows Forms is still the only way to write managed UI that will run on Win 2K and below. Couple this with the ability to detect whether Avalon is available and it becomes possible to write apps that will run on Windows 98 and still look great (via Avalon) on XP and Longhorn.

He says System.Windows.Forms is worth investing in still, even before the crushing of ideas due to time constraints kicked in.

[edit]
* I have no idea why I wrote "IE"

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

nonnus29
Member #2,606
August 2002
avatar

I used the winapi in a little utility I wrote last year. A lot of factors went into deciding to use it. The libs I considered were: java awt, java swing, wxwidgets, gtk, qt, fltk, and a couple of other winapi wrappers I can't remember.

In my case it all boiled down to deployment. I was making a tool to be used in my organization and we are standardized on java 1.3 so java was out. To use wx widgets, gtk, or qt would require bundling a huge set of dlls with the application (same reason .net was out). So I ended up settling for the plain winapi due to a small executable and I had to use the raw api to deal with threads and pipes anyway.

It is a shock how nasty it is. The bigger shock is how hard it is to use msdn online. But once you get used to it it's not that bad. No worse than the allegro gui imho. :o

Jonny Cook
Member #4,055
November 2003

I haven't used the Windows API that much, but from what I could tell it seemed pretty messy and inconsistent. I've used Qt a bit and it seemed really solid.

Now since I have access to a Mac I've been messing around with Cocoa. So far I really like it. At first I was put off from it because it's main language is Objective-C, but I've read a few tutorials on it and made some programs and I'm really starting to like it. It's surprisingly flexible. And I must say, Interface Builder is quite handy.

The face of a child can say it all, especially the mouth part of the face.

Thomas Fjellstrom
Member #476
June 2000
avatar

Quote:

Please correct me if I'm wrong, but WPF seems to have been marketed, at least in my experience, as a sort of Flash-esque replacement.

The way I heard it, WPF is akin to Apples PDF rendering, a more flexible layouting based framework.

Quote:

I had to use the raw api to deal with threads

QThread, not sure if QFile can handle win32 pipes though, or if theres an api for it anywhere in Qt. QIODevice can handle them with a subclass thats for sure.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

 1   2 


Go to: