Re: Send commands to Apps
VB Code:
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Allows program to be executed via command line, given a filename as an argument
Dim sArgs() As String = GetCommandLineArgs()
If Not sArgs(0) = Nothing Then
If File.Exists(sArgs(0)) Then
Remove_Garbage(sArgs(0))
End If
Application.Exit()
End If
End Sub
Function GetCommandLineArgs() As String()
Dim separators As String = " "
Dim commands As String = Microsoft.VisualBasic.Command()
Dim args() As String = commands.Split(separators.ToCharArray)
Return args
End Function
Re: Send commands to Apps
wild_bill,
How does one define a specific argument. EG. -kill means application.exit, for example, where is that done.
Could you please Include an Example.
Thanks you.
Re: Send commands to Apps
You just write code in your application to handle whatever data is in the Command Line arguments. The bigger problem you are going to have is that the application will only get these upon start up. So if you try to send commands to an application after it is running then it will spawn a new instance. You have to make a way to pass the command line from the new instance to the already running one.
Try this it does pretty much exactly that:
http://www.edneeis.com/example.aspx?ID=17
Re: Send commands to Apps