Solved

Pass parameters to a running process

Posted on 2008-10-09
5
850 Views
Last Modified: 2013-11-07
Hi guys!

Any tips how to pass parameters to an running process?

and with that I mean is not when I start the process I need to pass parameters when the process is already running.
0
Comment
Question by:AWestEng
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 22

Expert Comment

by:Ivo Stoykov
ID: 22678874
Are you sure process accepts params during run. May be you want to hack it ;-)

I
0
 
LVL 2

Assisted Solution

by:MTEXX
MTEXX earned 100 total points
ID: 22679146
Without knowing what application you are thinking about, it is impossible to say.
But if you are writing the application, then here are a few tools you can use:

- inter process communication / shared memory
- writing / reading to a file or directory
- connecting to a socket
- firing off another instance of that module using command arguments
- sendMessage and postMessage
- directly manipulating in-process memory

If you are indeed referring to an existing software product, please tell us what it is.

Cheers!
0
 
LVL 1

Author Comment

by:AWestEng
ID: 22679276
Both application is coded by me
from the Main App. I do this..
When TestApp is up and runing I need to pass a parameter to TestApp so I can close it correctly, I can't use the kill process, I need to run some code in TestApp before it closes.
 

'// Code from Main App
Dim myProcess As Process = New Process() 
myProcess.StartInfo.FileName = applicationPath & "TestApp.exe" 
Me.LaunchedProcess = myProcess 
myProcess.Start() 
 
Private Property LaunchedProcess() As Process 
   Get 
      Return m_serverProcess 
   End Get 
   Set(ByVal Value As Process) 
      m_serverProcess = Value 
   End Set 
End Property 

Open in new window

0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 400 total points
ID: 22680133
Like I said earlier AWestEng, the easiest way to do this is to make your app use the default Application Framework Events and make it a Single Instance Application.  Then you can call your EXE again with command-line parameters and it will fire the StartupNextInstance() event in your ORIGINAL application.  From there you can access the parameters and make code in the already running instance fire:

My.Application.StartupNextInstance()
http://msdn.microsoft.com/en-us/library/b9z4eyh8.aspx

Overview of the Visual Basic Application Model
http://msdn.microsoft.com/en-us/library/w3xx6ewx.aspx

I will be working on the code in your other PAQs today...  =)
0
 
LVL 1

Author Comment

by:AWestEng
ID: 22680225
thx m8.
I have change to the default Application Framework as you can see in the other PAQ.
 
0

Featured Post

Raise the IQ of Your IT Alerts

From IT major incidents to manufacturing line slowdowns, every business process generates insights that need to reach the people required to take action. You need a platform that integrates with your business tools to create fully enabled DevOps toolchains.

You need xMatters.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question