Hardy,
I'm still not sure what you are doing.
However, as I understand it well, I would for this definitly use the
Registry.
The Registry is easy to invoke in .Net and especially made for this kind of
things.
Don't hesitate to use it, as you see how much Microsoft uses the registry
themselves for all kind not OS programs, then you are just a low lever user
of that.
Just my idea,
Cor
Hardy,
In my idea can you only call a complete program, not direct a Sub from a
program direct from another external program (as it is not linked or
whatever)
Will you give us a sample how you did it, can be quiet interesting.
Cor
Ok here is what I am really doing. Trying to turn on X-10 lights.
These are lights in a house which are lettered and numbered eg
A1,A2,B1,B2 etc up to 16 I think! They are controlled via the mains
wiring.
Now what follows I learned on this group a few days back: I create a
load of classes - this is the one for urning on light A1.
Class X10_command
Inherits BaseCommand
Public Overrides Sub Execute()
' Does all the A indexes
controller.SendCommand(X10HouseCode.A, device_number,
X10Command.TurnOn)
End Sub
End Class
I have an array of string defined at the top of the form
Private _commandNames As String() = New String(100)
Private _typeLookup As New Dictionary(Of String, String)()
and this in the Load_form bit
Sub init_commands()
' init lookup stuff for example
Dim types() As Type = Assembly.GetExecutingAssembly().GetTypes
()
For Each t As Type In types
If t.BaseType.Equals(GetType(BaseCommand)) Then
_typeLookup.Add(t.Name, t.FullName)
End If
Next
I then have:
These _commandNames needed for switching devices etc and commands
For i = 0 To however many I need
_commandNames(i) = action_string(i)
Next
where action_string(i) is an array of strings with all commands
including the above X10_command.
Then to execute any command I have this
Public Sub select_command(ByVal com_number As Integer)
' Next is the command number from 0 to number commands-1
' go up to number of actions -1 as max index
Dim command As BaseCommand = _
DirectCast(Assembly.GetExecutingAssembly().CreateInstance
(GetCommand(com_number), True), BaseCommand)
command.Execute()
End Sub
Now to execute any command i I can just do
select_command(i)
Works beautifully! Trouble is I need to repeat this for as many
letters (the numbers are ok) and commands, On,Off,Dim,Brighten etc So
what I want is to take the DLL that has
controller.SendCommand(X10HouseCode.A, device_number,
X10Command.TurnOn)
and replace X10HouseCode.A and X10Command.TurnOn dynamically so they
can be for example
X10HouseCode.B or X10Command.TurnOff for example. Then I would only
need one class instead of numerous.
Hardy