Hello World Sample

This is the completed "hello world" extension.  It adds a menu item under the Tools menu, responds to the menu event, and displays a message box.



<pss_extension name="Hello World Sample" version="1.0">Sample Hello World Extension
<author email="support@dtlink.com" name="DTLink Software" url="http://www.dtlink.com" />
<script language="VBScript">
<![CDATA[

' Hello world sample for Personal Stock Streamer
' Copyright © 2005 by DTLink Software, All rights reserved.
' http://www.dtlink.com
' written by Anatoly Ivasyuk

class HelloWorldHandlerClass

	' menu event handler
	public Function OnMenuItemSelected( id )
		If (id = menuId) Then
			MsgBox "Hello, World", vbOKOnly
			
			' set return value to indicate that menu selection was processed
			OnMenuItemSelected = True
		End If
		
	end Function

	Dim menuId
	
end Class

' ================================================
' create the menu

Set EventManager = Application.GetObject("EventManager")
Set MenuManager = Application.GetObject("MenuManager")
Set Handler = new HelloWorldHandlerClass

If Not MenuManager Is Nothing Then
	Set MainMenu = MenuManager.MainMenu
	Set ToolMenu = MainMenu.GetSubMenu(MainMenu.Find("Tools"))

	If Not ToolMenu Is Nothing Then
		Handler.menuId = ToolMenu.InsertItem(ToolMenu.ItemCount, "Hello World")
	End If
End If

If Not EventManager Is Nothing Then
	EventManager.RegisterHandlerMethod Handler, "OnMenuItemSelected"
End If

]]>
</script>
</pss_extension>