Solved

Pass parameters to a running process

Posted on 2008-10-09
5
836 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
thx m8.
I have change to the default Application Framework as you can see in the other PAQ.
 
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

744 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

15 Experts available now in Live!

Get 1:1 Help Now