Registration
Before you can use SPRAY as OLE server you have to start it once manually, i.e. run it using the corresponding Start menu command or executing the program spray99.exe. At program start, SPRAY will be registered as the OLE server 'Spray99.Spray_Remote' on your machine.
VisualBasic implementation
In the following the VisualBasic code is in blue whereas all comments are in black.
Declaration:
To use SPRAY in a VisualBasic macro you have to declare it as a public object:
Public Spray As Object
Create the OLE server:
Before you can call SPRAY commands and properties you have to create the OLE server with the CreateObject command:
Sub create()
Set Spray = CreateObject("Spray99.Spray_Remote")
End Sub
Loading a configuration:
Once SPRAY is created you can load a SPRAY configuration by assigning a filename to the load_configuration property:
Sub load_file()
Spray.load_configuration = "C:\spray2\ole_test.s99"
End Sub
Saving a configuration:
If the SPRAY settings have been modified by OLE automation you can save the configuration by assigning a filename to the save_configuration property:
Sub load_file()
Spray.save_configuration = "C:\spray2\ole_test2.s99"
End Sub
Show SPRAY:
The show command shows SPRAY on the screen
Sub show_spray()
Spray.show
End Sub
Hide SPRAY:
The hide command shows SPRAY on the screen
Sub hide_spray()
Spray.hide
End Sub
Cleaning up:
To finish your work you should remove SPRAY from memory which is done in VisualBasic the following way:
Sub destroy()
Set Spray = Nothing
End Sub