Thursday, August 17, 2006

Start Menu Mess

As one might imagine when reading some of my recent posts (Not quite Quicksilver, and Quicksilver) my start menu on my main machine is out of control. I can't find anything anymore. I've long been a fan of the Quick Launch bar, but that steals precious pixels.

So I decided to be a good geek and code my own solution. It ain't beautiful, but it ain't ugly either. Best part? Only took a few hours , a good part of which was spent fiddling with silly things like the icon editor. It is hard-coded to look at the All-Users start-menu, the current-user start-menu and the current user's Quick Launch bar. It builds a list of all entries and lets your type just part of a name and sorts the list of entries based on what your have typed so far. When you type or double-click on an entry from the list, it runs whatever you selected, then hides itself. It is hooked to Window-, so you can run it from anywhere/anytime.

Here is a screen-shot:


Best part? C# + WinForms + P/Invoke mean that it only took a few hours to build. The VS 2005 WinForms builder is vastly better than what was available before. DataBinding in the ListBox control made binding my sorted list to a list-box trivial. P/Invoke meant that I could easily invoke the necessary Win32 APIs for ShellExec or to bind to Win-Space. Developer productivity baby!

There are still lots of gotchas... It doesn't resize. It is 2006 and the UI layout tools in VS _still_ doesn't generate code for an automatic resize. Delphi had this down in the 90s folks! Why doesn't VS ship with a Win32 P/Invoke library? Shouts out to Http://pinvoke.net, but I often find that the code provided can only be used as a template. MSDN and Microsoft User-Education should be all over this... P/Invoke and a standardized Win32 CLR library would make writing sample code for Win32 so much better. C#/CLR may be here to stay but Win32 ain't going away, either.

It still has some kinks to work out, and the code could use some clean-up. The biggest issue I'm trying to track down is why it beeps at me when I type <escape> or run an app... Not much of a problem, since I often run with sound off, but I'd like understand why it is doing that.

Hopefully I'll get all that figured out next week while on holiday visiting my family, and then I can post the source.

1 Comments:

Anonymous Anonymous said...

Might I ask how you index the shortcuts? I've written something quite similar to yours (also in c#), but I did it in .net 2.0, so I used environment.specialfolder.startmenu or something for the user specific folder, and you can read out a regkey to get the all users folder...
But my indexing is tragically slow, just because it is, so I was wondering if we might exchange some code?

7:12 AM  

Post a Comment

<< Home