0

I am trying to build a program in C++ that simply suspends and resumes a program (with PID), but can't find the necessary tools to solve the problem.

  • are you trying to suspend another program by yours ? – Anis Belaid Nov 05 '21 at 09:39
  • 1
    You can't, because the notion of process is operating system specific. So on Linux and on Windows, the code will be very different. See also frameworks like [Qt](https://qt.io/) or [POCO](https://pocoproject.org/). For Linux, read about [syscalls(2)](https://man7.org/linux/man-pages/man2/syscalls.2.html) – Basile Starynkevitch Nov 05 '21 at 09:40
  • I am trying to suspend another process in windows through my c++ program – yoyopi768 yoyopi768 Nov 05 '21 at 09:40
  • 2
    Then you need to tag with Windows your question, and probably with Windows10 or Windows11. Ar you allowed to use [Qt](https://qt.io/) or [POCO](https://pocoproject.org/) ? What will happen to you if you did? **Both are open source projects, and you could study their code for inspiration** – Basile Starynkevitch Nov 05 '21 at 09:41
  • 1
    you can get PID program call system function through a c++ program.see https://man7.org/linux/man-pages/man3/exec.3.html for example – Anis Belaid Nov 05 '21 at 09:41
  • I am trying to do it without Qt or POCO – yoyopi768 yoyopi768 Nov 05 '21 at 09:43
  • @AnisBelaid: unfortunately for him, OP is using some Windows OS... – Basile Starynkevitch Nov 05 '21 at 09:43
  • Use [DebugActiveProcess](https://learn.microsoft.com/en-us/windows/win32/api/debugapi/nf-debugapi-debugactiveprocess) _"... The system suspends all threads in the process, and sends the debugger events that represents the current state of the process...."_ – Richard Critten Nov 05 '21 at 10:25

0 Answers0