DevNav, Your Floating Window to the Developer's World

Jeroen de Jong
Software Design Engineer, Microsoft Developer Network

June 25, 1996

Have you ever wished that you could go back to the For Developers Only home page or any of the other For Developers Only sites on the World Wide Web with just one click of the mouse? Or easily search any of the For Developers Only Web sites, no matter where you are?

Well, perhaps not, but that didn't stop us from writing a little Visual Basic® applet that does exactly that. This applet talks to the Web via URL.DLL, and with some extra code it manages to stay on top of your desktop for as long as it is running.

You can install DevNav by downloading the insanely large DEVNAVZIP.EXE file (~1MB), which has all the DLLs and other stuff that Visual Basic applications require, and then running SETUP.EXE. Or, if you already have Visual Basic 4.0, or any Visual Basic 4.0 application on your system, you only need to download DEVNAV.EXE (~30K). (See the DevNav download page.)

Devnav does not include URL.DLL, which is included with Internet Explorer, the Windows® 95 Plus Pack, and the ActiveX™ SDK.

You can start and stop DevNav like any other application. DevNav will start your browser, unless your browser is already running, in which case the current instance is used. DevNav doesn't alter the behavor of the browser in any way; rather, it just sits there on your desktop, waiting for you to instruct it to go off and find the For Developers Only Web sites.

How Does DevNav Work?

Essentially, DevNav does only two things: (1) it desperately tries to stay on top of all other windows, and (2) it uses URL.DLL to talk to the Web.

I found the code to make DevNav stay on top in the MSDN Library CD, in one of the Visual Basic for Windows Knowledge Base articles. When I created the project in Visual Basic, I added a .BAS module file and included the following declaration:


Declare Function SetWindowPos Lib "user32" _
       (ByVal hwnd As Long, _
        ByVal hWndInsertAfter As Long, _
        ByVal x As Long, _
        ByVal y As Long, _
        ByVal cx As Long, _
        ByVal cy As Long, _
        ByVal wFlags As Long) As Long

followed by these constant declarations:

Global Const SWP_NOMOVE = 2
Global Const SWP_NOSIZE = 1
Global Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
Global Const HWND_TOPMOST = -1
Global Const HWND_NOTOPMOST = -2

To bring the DevNav window to the top, I added the following line to the Load procedure for the form (which, by the way, is called "Floater," because we hadn't yet decided on a name for the final application):

    'bring window to top
    rv& = SetWindowPos(Floater.hwnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS)
    'rv& <> 0 When Successful

And that's all, really.

So how did I enable DevNav to go off and load a Web page in the browser? Well, the code behind each of the menu commands looks like this:


    Dim rv&
    rv& = ShellExecute(GetDesktopWindow(), _
          "open", "http://www.microsoft.com/visualc", _
          0&, 0&, SW_SHOW)

I added the getDestopWindow() function to the .BAS module:

Declare Function GetDesktopWindow Lib "user32" _
        () As Long

The code behind the Search mechanism is slightly different, but uses the same technology to talk to the Web:

    Run$ = "http://webfind.home.msn.com/cgi-bin/fts.dll?db=mssite&gr=" _
           & site$ & "&qu=" & txtSearch.Text
    rv& = ShellExecute(GetDesktopWindow(), "open", Run$, 0&, 0&, SW_SHOW)

where "site$" holds one of the values from the drop-down list, and "txtSearch.Text" refers to the field where the user can type in a search string.

For more information on URL.DLL, see Supporting Internet Shortcuts in Your Windows Applicationsinternet link on this Web site.

Coming soon... I'll show you how we can customize DevNav to make it link to any site you want.

UpBack to Tips on Using this Site

UpUpBack to Site Builder Workshop home page