Hello I would like to know how its possible to send multiple entries to a process
I have achieved this by opening a process for every file I pass to it but this is very messy and runs to many individual process of the same kind because the sub is called from within a loop.
How can I pass multiple commands to only one instance of the process instead of having to start a new process with every command?...
This might be easy to do as I am sure it is but I cannot find much help because of the nature of this where people only wish to do something such as starting "notepad.exe". My example must first run the process and then it is passed the arguments for that file which is the file path of the process i wish to start and the file path of the file I want to perform work.
(eg.) "C:\folder\process.exe" "C:\folder\Myfile.txt"
thank you in advance..
Here is the code that I have found...
The Client window (Windows form application)
consists of one textbox named txtText and one button named cmdSend
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels
Imports System.Runtime.Remoting.Channels.Ipc
Public Class Form1
Private Sub cmdSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSend.Click
Dim ipcCh As New IpcChannel("cmd.exe")
ChannelServices.RegisterChannel(ipcCh, False)
Dim obj As SharedInterfaces.ICommunicationService = _
DirectCast(Activator.GetObject(GetType(SharedInterfaces.ICommunicationService), _
"ipc://IPChannelName/SreeniRemoteObj"), SharedInterfaces.ICommunicationService)
obj.SaySomething(txtText.Text)
ChannelServices.UnregisterChannel(ipcCh)
End Sub
End Class
The Server console (console application)
Here is the code from the Main.vb
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels
Imports System.Runtime.Remoting.Channels.Ipc
Module Main
Sub Main()
Dim ipcCh As IpcChannel
ipcCh = New IpcChannel("IPChannelName")
ChannelServices.RegisterChannel(ipcCh, False)
RemotingConfiguration.RegisterWellKnownServiceType( _
GetType(CommunicationService), "SreeniRemoteObj", _
WellKnownObjectMode.Singleton)
Console.WriteLine("Press ENTER to quit")
Console.ReadLine()
End Sub
End Module
Also in the console program there is another called CommunicationService.vb
Public Class CommunicationService
Inherits MarshalByRefObject
Implements SharedInterfaces.ICommunicationService
Public Sub SaySomething(ByVal text As String) Implements SharedInterfaces.ICommunicationService.SaySomething
Console.WriteLine("The client said : " & text)
End Sub
End Class
And finally a class library part called SharedInterfaces
Public Interface ICommunicationService
Sub SaySomething(ByVal text As String)
End Interface
My problem is that the program starts the console application from where I have no idea and really what i think i need is to have a process and only one process to start and then pass the strings to it one after another.
thank you for your patients.