Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Pass parameters to a running process

Posted on 2008-10-09
5
Medium Priority
?
860 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 400 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 1600 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

610 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