DeskBro






DeskBro for IE3

This part of DeskBro has been shelved and I do not supply demonstration files anymore. This is in part because ActiveX has security implications and in part because the new version of DeskBro for IE4/5 will work although some versions of IE3 display a security dialog. The only advantage to using an ActiveX component is that it allows a single click to launch a program like a web page and displays a tool tip (hint) window. I consider these advantages to be so minor as to be not worth the effort.

This section shows how it is possible to build an ActiveX component but you do so at your own risk. You will need a copy of Visual Basic 5 (or greater) and experience of using ActiveX controls in Web Pages using Setup Wizard (there's a whole section in the back of the Programmers Manual giving detailed explanations of how to use it). Create a new ActiveX Control project and insert the following code.

	Private Sub UserControl_Initialize()
    		Debug.Print "hello"
	End Sub

	Public Function Hello(ByVal param As String) As String
	Dim b As Long

	On Error GoTo err_Hello
	    	b = Shell(param, vbNormalFocus)
    		AppActivate b
    		Hello = b
	Exit Function

	err_Hello:
    		Hello = "false"
	End Function
	

And that's all there is to the code. Save it, create an .OCX and run t through the Wizard. Now the HTML and VBScript required to make it all work. The first bit is a standard HTML header.

	<HTML>
		<!-- Author: Nick Cheesman 1999 -->
	<HEAD>
		<!TITLE>Nick Cheesman's ActiveX Page
	</HEAD>
	

The next bit of HTML will have been created for you by the Wizard and will look a little different particularly the long number (GUID).

	<OBJECT ID="UserControl1" WIDTH=1 HEIGHT=1
		CLASSID="CLSID:F4053D7B-BC2D-11D2-AA74-0080C8291585"
		CODEBASE="Project1.CAB#version=1,0,0,0">
	</OBJECT>
	

Now for the code that calls the ActiveX component laying dormant in the browser.>

	<SCRIPT LANGUAGE="VBScript">
	<!--
	Sub RunNp
  	Dim TheForm
		a = usercontrol1.hello("notepad.exe")
		' msgbox a
	End Sub
	-->
	</SCRIPT>
	

The the message box can be used for debugging so you can see what the output is but is best left commented out. Now it is just a matter of providing the links and finishing off the HTML as follows.

	<a href="h3mono1b.htm" onclick="RunNp">
	<img src="notepad.jpg" alt="Notepad" border="0">
	</BODY>
	</HTML>
	

That's it. Run the HTML file through IE3 (so far I've been unable to make it work with later browsers) with the security set to medium. You will be asked wether to allow the download of the component which will be stored locally. Answer Yes. The component will then run invisibly and clicking on the link will run Notepad.

"But what about the Control Panel Applets", I hear you cry. Fear not. What goes between the quotation marks in the call to the Hello component controls what program is run. The Control Panel is slightly different and uses a special .DLL in Windows. Try this.

	<SCRIPT LANGUAGE="VBScript">
	<!--
	Sub RunNp
  	Dim TheForm
		a = usercontrol1.hello("rundll32.exe shell32.dll,Control_RunDLL timedate.cpl")
		' msgbox a
	End Sub
	-->
	</SCRIPT>
	

This will run the Date Time applet. The only thing that has changed is the call to the hello component. Here are some more examples.

	a = usercontrol1.hello("Rundll32.exe shell32.dll,Control_RunDLL main.cpl @2")
	

This runs applet number 2 (varies from install to install but runs the printers setup window on my machine) in the main control panel. Trying to run an uninstalled applet will result in an error. Control panel itself is as follows:-

	a = usercontrol1.hello("rundll32.exe shell32.dll,Control_RunDLL")
	

There are probably many more awaiting discovery but that should get you started. The final icing on the cake would be icons. Just take a snapshot of a window (ALT-Print Screen) and cut and paste the icon into a graphics program to create a .JPG and use it with the links to the various programs.


Back To Menu

Back to MonoCall

Written by Nick Cheesman. Last updated: 01/05/2000
Please eMail me at: njc1@netcomuk.co.uk