Thursday, January 25, 2007

Guter Gott...

Oh yeah. Now I remember why I always hated working with Microsoft Windows. When I started delving into the guts of shell programming, for the first time in a very long time indeed, it was with a fairly relaxed notion that since the Desktop is a folder, the information about the location of the icons on the Desktop must be in a relatively easy-to-find location or have relatively easy-to-use interfaces.

I was wrong. Oh, granted, I'm pretty sure I've found something (IShellView2 exposes a SelectAndPositionItem method) but it took a day's reading, and that just isn't time I had. It escalated into a sort of obsession, and at the end of the day, all I have to show for it is maybe I can move the fricking icons around on my Desktop, for some versions of Windows.

I say "maybe" because there's no fricking documentation for it. That's a situation I run across in open-source programming, of course, but in the open-source world I could look at the code for Explorer and see how Explorer does it. Here, that avenue is closed to me, not because it's important for Microsoft to hide it, but because it's simply not important for Microsoft to divulge it. The default is secrecy. And that default is, at the heart of it, precisely what is wrong with the world in general. I won't go into the obvious political ramifications because I'm pretty sure if I started in on it I'd shock Dana's maiden heart, but suffice it to say that Windows sucks. Sure, it's usable -- has to be, to perfuse the market to this extent -- but it's just marginally programmable. And for no real reason.

Back in the Good Old Days, when I was doing a whole lot of VB programming under Microsoft Word 6.0, is when I first realized this about Microsoft's worldview. Even then, Word was quickly establishing itself as the industry standard for document editing and storage, and so there was no alternative. And I'll be the first to admit that exposing Word's innards in Visual Basic for programming was brilliant -- I loved it. But whereas the motto of Perl (a language I learned much later) is to make easy things easy and hard things possible, the unstated motto of Word Basic was to make easy things possible and hard things unimaginable. There were things I simply could not do, no matter how many weeks I spent hacking on them. (Back then, as a paid minion, I had the weeks to spend -- now it would simply be out of the question and on to the next project idea.)

With open source, the documentation is of comparable quality, but when the documentation gives out, there is at least some working example code in whatever product originally inspired the interface or function or what-have-you in the first place. The thing was written to solve a problem, and the solution is an open book. With closed-source, somebody obviously solved it, but they will not tell you the solution.

Ugh. I hate them all.

On the other hand, I have found lots of nice pieces for app #3 -- for instance, I can still build a directory monitor using SHChangeNotifyRegister. This installs a window to be passed messages from the Windows Shell (i.e. Explorer and the Desktop) whenever files are created, written, moved, deleted, etc. Instead of polling a directory on a timer, therefore, I can just sit hidden in the background until something happens. Much cheaper in terms of system resources.

And really, just getting that much working would be a valuable addition to my framework; I'll probably just call that app #3 like the coward I am, and call the icon mover action app#4, unless somebody can show me an easier way of going about it. The sticky wicket is that the Python COM model doesn't wrap IShellView2, so if I want to go that route I'll have to wrap it. And I don't want to. So you Windows mavens, now's your chance to show me how much Windows doesn't suck. If you can.

0 Comments:

Post a Comment

<< Home