Self terminating/Killing application
-
I have a requirement to create an application which will accept the command line parameter. Depening on the parameter passed to the application, it will start and stop. For Ex. on command prompt C:\>MyExe start This command will start the application for a given task. C:\>MyExe stop If MyExe is already running then the above command will stop it. Appreciate your help.
-
I have a requirement to create an application which will accept the command line parameter. Depening on the parameter passed to the application, it will start and stop. For Ex. on command prompt C:\>MyExe start This command will start the application for a given task. C:\>MyExe stop If MyExe is already running then the above command will stop it. Appreciate your help.
What is the type of application ? Console, Win32, MFC, ... Your question is not very clear.
Cédric Moonen Software developer
Charting control -
I have a requirement to create an application which will accept the command line parameter. Depening on the parameter passed to the application, it will start and stop. For Ex. on command prompt C:\>MyExe start This command will start the application for a given task. C:\>MyExe stop If MyExe is already running then the above command will stop it. Appreciate your help.
Ravi Jadhav wrote:
C:\>MyExe stop
That will run a second instance of MyExe. You'll need to use IPC to look for a running instance and tell it to stop its work.
--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
-
I have a requirement to create an application which will accept the command line parameter. Depening on the parameter passed to the application, it will start and stop. For Ex. on command prompt C:\>MyExe start This command will start the application for a given task. C:\>MyExe stop If MyExe is already running then the above command will stop it. Appreciate your help.
Ravi Jadhav wrote:
If MyExe is already running then the above command will stop it.
do you want to create service!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV
-
What is the type of application ? Console, Win32, MFC, ... Your question is not very clear.
Cédric Moonen Software developer
Charting controlIt would be Win32 or MFC application
-
Ravi Jadhav wrote:
C:\>MyExe stop
That will run a second instance of MyExe. You'll need to use IPC to look for a running instance and tell it to stop its work.
--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
I dont want the second instance. Can you please help me how to use IPC?
-
It would be Win32 or MFC application
-
Ravi Jadhav wrote:
If MyExe is already running then the above command will stop it.
do you want to create service!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV
It would be Win32 or MFC application
-
I dont want the second instance. Can you please help me how to use IPC?
Start by searching for "single instance" here - that will show you how to tell if another instance is runing.
--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
-
I have a requirement to create an application which will accept the command line parameter. Depening on the parameter passed to the application, it will start and stop. For Ex. on command prompt C:\>MyExe start This command will start the application for a given task. C:\>MyExe stop If MyExe is already running then the above command will stop it. Appreciate your help.
Create some gloabl object like NamedPipe, Mutux etc to manage single instance Use PostQuitMessage to exit
-
I have a requirement to create an application which will accept the command line parameter. Depening on the parameter passed to the application, it will start and stop. For Ex. on command prompt C:\>MyExe start This command will start the application for a given task. C:\>MyExe stop If MyExe is already running then the above command will stop it. Appreciate your help.
Could you find a simpler way to solve your problem? Example C:\>MyExe start write on a registry or on a fixed file RUN = TRUE and then the program will start C:\>MyExe stop write on a registry or on a fixed file RUN = FALSE and this instance ends The first instance, thatsometimes (like into the OnIdle function) are checking the key , understands that he needs to be closed and .... close itself:). hope that helps
-
Could you find a simpler way to solve your problem? Example C:\>MyExe start write on a registry or on a fixed file RUN = TRUE and then the program will start C:\>MyExe stop write on a registry or on a fixed file RUN = FALSE and this instance ends The first instance, thatsometimes (like into the OnIdle function) are checking the key , understands that he needs to be closed and .... close itself:). hope that helps
This is a poor solution as it involves polling and persistent storage. Steve
-
This is a poor solution as it involves polling and persistent storage. Steve
Hi
Stephen Hewitt wrote:
poor solution as it involves polling and persistent storage
I know that,... I according to you:-D. But the bettest (if exist:)) solution depends on how complex is his program and how much time he coud spend on this problem. My suggestion is only an example, he probally can adapt it to his program, or it can be a way to find a more simple way. If not,...well he has many other ways, according to others resp. Bye
-
It would be Win32 or MFC application
Ravi Jadhav wrote:
It would be Win32 or MFC application
try this http://www.codeproject.com/cpp/csingleinst.asp[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV
-
Ravi Jadhav wrote:
It would be Win32 or MFC application
try this http://www.codeproject.com/cpp/csingleinst.asp[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV
Thanks I think this will suffice my requirement
-
I have a requirement to create an application which will accept the command line parameter. Depening on the parameter passed to the application, it will start and stop. For Ex. on command prompt C:\>MyExe start This command will start the application for a given task. C:\>MyExe stop If MyExe is already running then the above command will stop it. Appreciate your help.
So what exactly is the question? You've given us a high-level overview, but nothing specific. :confused:
"The largest fire starts but with the smallest spark." - David Crow