Click here to Skip to main content
15,881,139 members
Articles / Desktop Programming / ATL
Article

A Utility for Browsing Directly to a Microsoft Knowledge Base Article

Rate me:
Please Sign up or sign in to vote.
4.56/5 (3 votes)
3 Apr 2001 89.3K   729   29   14
A utility that lets you browse to a MS Knowledge Base article right from the Run dialog

Introduction

If you've ever had to look up a Knowledge Base article using its number, you know that the process it a bit tedious. First browse to msdn.microsoft.com, enter the article number in the tiny search edit box, wait for the search results to come back, and then finally click the link to the article. There isn't a quick way to jump right to an article, until now!

KBLaunch is a shell extension that extends the Run dialog. Simply enter ?q followed by the article number, as pictured here:

 [Example Run dialog - 6K]

When you hit Enter, KBLaunch runs your default browser and points it right at the web page for the article.

How It Works

KBLaunch registers itself as a shell execute hook. Shell execute hooks are called in two cases:

  1. Whenever a program is run with ShellExecute() or ShellExecuteEx(). This includes double-clicking on a file in Explorer.
  2. Whenever the user enters something in the Run dialog.

What's interesting about hooking the Run dialog is that we can let the user enter something that isn't a program name, but which instructs our extension to do something. Internet Explorer is a good example of this - if you enter a URL (starting with http, ftp, www, or other common prefixes), the shell execute hook provided by IE interprets that and launches the browser.

KBLaunch looks for the prefix ?q, and then reads the rest of the command line. If it is a positive number, KBLaunch constructs the URL for the article and runs your default browser with ShellExecute(), passing it that URL. Note that this makes use of IE's own shell execute hook (described above) to launch the web browser, so you'll need IE 3 or later installed.

A shell execute hook extension is almost trivial - there's only one interface to implement, and that interface only has one method. The method is IShellExecuteHook::Execute(), and it receives a pointer to a SHELLEXECUTEINFO struct which holds a bunch of info about the program being run. Execute() handles parsing the command line and running the browser, as described above. The code for this is in the KBLaunchShlExt.cpp file in the sample project.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Software Developer (Senior) VMware
United States United States
Michael lives in sunny Mountain View, California. He started programming with an Apple //e in 4th grade, graduated from UCLA with a math degree in 1994, and immediately landed a job as a QA engineer at Symantec, working on the Norton AntiVirus team. He pretty much taught himself Windows and MFC programming, and in 1999 he designed and coded a new interface for Norton AntiVirus 2000.
Mike has been a a developer at Napster and at his own lil' startup, Zabersoft, a development company he co-founded with offices in Los Angeles and Odense, Denmark. Mike is now a senior engineer at VMware.

He also enjoys his hobbies of playing pinball, bike riding, photography, and Domion on Friday nights (current favorite combo: Village + double Pirate Ship). He would get his own snooker table too if they weren't so darn big! He is also sad that he's forgotten the languages he's studied: French, Mandarin Chinese, and Japanese.

Mike was a VC MVP from 2005 to 2009.

Comments and Discussions

 
GeneralVisual C++ .NET compile error Pin
ribico24-Mar-06 6:01
ribico24-Mar-06 6:01 
GeneralRe: Visual C++ .NET compile error Pin
Michael Dunn24-Mar-06 7:07
sitebuilderMichael Dunn24-Mar-06 7:07 
Generaldoes not work Pin
akulkarni17-Aug-04 6:20
akulkarni17-Aug-04 6:20 
GeneralRe: does not work Pin
Michael Dunn17-Aug-04 6:27
sitebuilderMichael Dunn17-Aug-04 6:27 
Generaldownload manger Pin
Alexander M.,27-Oct-03 8:13
Alexander M.,27-Oct-03 8:13 
GeneralRe: download manger Pin
Michael Dunn30-Mar-04 11:15
sitebuilderMichael Dunn30-Mar-04 11:15 
QuestionHow to debug? Pin
5-Mar-02 13:16
suss5-Mar-02 13:16 
AnswerRe: How to debug? Pin
peterchen19-Sep-02 5:10
peterchen19-Sep-02 5:10 
GeneralKnowledge Base Tracking Pin
Nick Parker1-Mar-02 6:41
protectorNick Parker1-Mar-02 6:41 
GeneralEffort vs Result Pin
29-Mar-01 20:23
suss29-Mar-01 20:23 
GeneralRe: Effort vs Result Pin
Michael Dunn29-Mar-01 20:33
sitebuilderMichael Dunn29-Mar-01 20:33 
GeneralGreat idea...But, can we figure out how a command was launched. Pin
CMFC6.0VS.NETUser26-Feb-01 4:44
CMFC6.0VS.NETUser26-Feb-01 4:44 
GeneralRe: Great idea...But, can we figure out how a command was launched. Pin
Michael Dunn27-Feb-01 13:35
sitebuilderMichael Dunn27-Feb-01 13:35 
GeneralRe: Great idea...But, can we figure out how a command was launched. Pin
CMFC6.0VS.NETUser1-Mar-01 4:19
CMFC6.0VS.NETUser1-Mar-01 4:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.