A
A
Anton Ivanov2018-03-24 09:20:46
C++ / C#
Anton Ivanov, 2018-03-24 09:20:46

How to close a background instance of a program?

Hello.
I haven't written in C++ for 14 years, I had to.
The bottom line is this, there is a background program app.exe (mine).
It is necessary to implement the functionality so that when app.exe stop is launched, an already running background process ends.
A Google search for "C++ close another app instance" yields recipes looking for an app by window title. But I don't like this option. I want unambiguity, as in . *nix when the program saves its pid to a file.
What decision is made in Windows programming?
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
res2001, 2018-03-24
@Fly3110

Use any inter-process communication (IPC) mechanism - sockets, pipes, named mutexes, shared memory, ...
Just send a message to the second process to close it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question