2003.09.12 08:31 PM

Windows Taskbar Wanderings

My mind wandered today to everything except what it was supposed to be doing. With some effort, I did eventually squeeze out some work on my immediate (paid) tasks, but accomplished much more in the way of nothing.

One thing that tweaked my interest today was tweaking my desktop. I've considered moving my Windows taskbar to a different position for some time, but never did it. Until now. Credit Raymond Chen's post today about how the taskbar came to be at the bottom of the screen for getting me thinking about it again.

In desperate need of a diversion, I moved it (again, again, and again), finally stopping on the left (width being more abundant than height). Nicest thing about this layout is that the Start menu flows down like a real menu. The not so nicest thing is that the Start button is too narrow.

By the way, that's WinXP using the classic style. I never got on board with the new XP styling (ugh).

Maybe I'm hard to please, but I'd like the Start button to span the entire width of the newly left-docked and slightly widened taskbar. Unfortunately, after much Googling, it seems it's sized to its contents. I did learn how to hack Explorer.exe to replace or shorten the button's contents or replace its icon. But, as far as I can tell, no one's making it wider. One guy on Google said he did it by getting the button's handle and munging it directly via API calls, but his changes would only last a moment.

Moving on, another thing the new layout needed was a shortcut for the quick launch toolbar to make an even dozen. After much thought about what I use the Start menu for, I settled on the Start menu's Run command (I know about the Windows hotkey, but my portable's keyboard makes it a very awkward stretch). Lo and behold, it turns out the Run command is not a program. Who knew? Probably everyone but me. I should have figured from what I was seeing in the Registry that it wasn't just a system shortcut. Back to Google.

It's really hard to get useful results from Google with searches like "show start run shortcut window". After looking through hundreds of links, I nearly gave up and began thinking about writing a quick script to prompt for a command and run it using WshShell.Run. Then I somehow stumbled into Brad Martinez and his little jewel regarding undocumented Shell32.dll functions. Though it hadn't been updated since 1997, it was just what I needed. Thanks Mr. Martinez.

Here's the undocumented, ordinally referenced Shell32.dll function declaration in VB6:

Declare Function SHRunDialog Lib "shell32" Alias "#61" _
 (ByVal hOwner As Long, _
 ByVal Unknown1 As Long, _
 ByVal Unknown2 As Long, _
 ByVal szTitle As String, _
 ByVal szPrompt As String, _
 ByVal uFlags As Long) As Long

And, here's a call to it (all default settings):

SHRunDialog 0, 0, 0, vbNullString, vbNullString, 0

I threw this into a quick VB6 project (.NET struck me as overkill; I'm probably wrong and should try it out), snipped the Run command icon from Shell32.dll (it's #25) and I was off to the races. Works great.

Now, except for the too-lean Start button (grrrr), my new taskbar has its old symmetry back, and I can get back to work.


Why do people use the undocumented methods when there's a perfectly good documented method? Save this one-line file as "Run.js"

(new ActiveXObject("Shell.Application")).FileRun();

Raymond Chen | 2003.11.10 08:55 AM

My first knee-jerk response: "I suppose because the undocumented method was a little less impossible to find than the documented one."

Then I noticed the author, Raymond Chen, whom I greatly admire, and reconsidered my wise-assness. My response now: "Oops. Thanks!"

The really mind-bending thing about my not having found the FileRun method is its description:

"Displays the Run dialog to the user. This method has the same effect as clicking the Start menu and selecting Run."


How in the name of all that is Google could that have failed to appear in any of my searches?! Oh well.

Mr. Chen, thanks so much for taking the time. As an aside, that's twice you've helped me in the last week. The other was a message you posted on the win32.programmer.ui newsgroup in 1998 to some fellow regarding incorrect use of the NOTIFYICONDATA uID. It wasn't my exact problem, but your comment got me to reevaluate the API doc and my code and ultimately solve my problem. Thanks, again.

ewbi.develops | 2003.11.10 10:10 AM

in taskbar strat button run command is not showing

dornala narendra | 2005.03.29 11:11 PM

Hi Dornala,

The appearance (or not) of the Run command on the Start button's menu is controlled by a property. Right-click the Start button (or bar), select Properties, go to the Start Menu tab, click the enabled Customize button, in the Advanced Start menu items list (or in the Start menu items list on the Advanced tab), find "Run command" or "Display Run" and check its box.

Hope that helps.

ewbi.develops | 2005.03.31 08:38 AM

Actually, I'm sure the reason people use the undocumented function is because 90% of the people looking for a way to pop up the run dialog are *not* using the default Explorer shell, and that "Shell" object is thus non-existent, since it's not part of the Windows API, but merely part of the Explorer API and doesn't work if Explorer has crashed or isn't set as shell ...

Joel "Jaykul" Bennett | 2005.09.12 06:23 PM

Joel, I'd almost forgotten about this post until your comment popped up today. Now after re-reading Raymond's comment I find it a bit snarky. I mean, it's my blog, he's come into my "house", and still he addresses me in the third person like I belong only to some huddled mass of API cheating weenies. I think I'll stand by my original smart-ass response: a "perfectly good documented method" isn't for shit if it's not widely known and not easily found. And, as you've pointed out (I assume based on your work with GeoShell), there are other legitimate reasons, too. Thanks for the comment.


ewbi.develops | 2005.09.13 04:03 PM

Perhaps I'm missing the point, but the way I put the Run command onto the QuickLaunch toolbar is by just dragging and dropping it from the Start menu. It's easy and I didn't have to Google anything....

Now, what I wich I _could_ remember how to do is make a "Run toolbar." The reason I say "remember" is because I used to have one on a previous computer. It looked kind of like the Google Deskbar: just a toolbar with a box into which you could type commands. I haven't been able to figure it out (or find any reference to such a beast) since then.

Mark Tomory | 2006.03.24 02:05 PM

...of course, twenty menutes after writing it, I found the answer, and it's mindlessly simple: it's the built-in "Address" toolbar.

Mark Tomory | 2006.03.24 02:27 PM

Hi Mark,

Thanks for the tip. Turns out the Run option can in fact be picked up from the Start Menu and dropped somewhere as a shortcut. I think I might have missed this because it is only true when using the non-Classic Start Menu, which I wasn't doing back in 2003 and am still not doing today (the Classic Start Menu is just so damned much cleaner than the other). However, it was simple to switch Classic mode off for a second and grab a Run command shortcut. Cool.

Btw, for anyone who cares, I abandoned the left-side taskbar described above sometime in early 2004. I got tired of dealing with badly behaved applications that couldn't deal with the change.

Regarding a floating Run-like command window, have you looked at SlickRun (previously QuickRun):


I haven't used it, so can't say whether it's any good. Looks like it's been around a while, though.

Good luck.

ewbi.develops | 2006.03.24 02:42 PM

Whoa, your comment arrived as I was typing mine.

I had forgotten about the Address toolbar, too. A tool like SlickRun offers some added features, though, like shortcut words for otherwise long target file paths.

Thanks for the comments.

ewbi.develops | 2006.03.24 02:48 PM

A renamed and wider Start menu button:


ewbi.develops | 2007.12.17 03:42 PM


TrackBack URL:  https://www.typepad.com/services/trackback/6a00d8341c7bd453ef00d83421ddda53ef

Listed below are links to weblogs that reference Windows Taskbar Wanderings: