Solved

Pass parameters to a running process

Posted on 2008-10-09
5
838 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
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 85

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

920 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now