|
-
May 10th, 2005, 07:27 AM
#1
Thread Starter
Addicted Member
Send commands to Apps
I want to make an App, for example will do a event like make the form transparent, but do so with command line parameters passed to it.
How & where does one Define it. Like some command line programs take -x, -w parameters. How can I Make c:\bin\er.exe -con mean that the program if alreay running will then make the form transparent. This isnt about making the form transparent, just to give an Example of what I mean
Curiosity SKILLED the cat
Google Talk from your Mobile phone
Chat from your mobile or get an emulator like J2ME Wireless Toolkit 2.2
-
May 10th, 2005, 09:22 AM
#2
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
-
May 11th, 2005, 03:31 AM
#3
Thread Starter
Addicted Member
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.
Curiosity SKILLED the cat
Google Talk from your Mobile phone
Chat from your mobile or get an emulator like J2ME Wireless Toolkit 2.2
-
May 11th, 2005, 10:30 PM
#4
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
-
May 12th, 2005, 04:11 AM
#5
Thread Starter
Addicted Member
Re: Send commands to Apps
Curiosity SKILLED the cat
Google Talk from your Mobile phone
Chat from your mobile or get an emulator like J2ME Wireless Toolkit 2.2
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|