Using SIGINT

前端 未结 6 1937
误落风尘
误落风尘 2020-12-18 15:24

According to this http://www.cplusplus.com/reference/clibrary/csignal/signal.html

SIGINT is generally used/cause by the user. How do i cause a SIG

6条回答
  •  情书的邮戳
    2020-12-18 16:00

    I assume this is a Win32 app...

    For a "controlled" or "safe" exit, if the app uses a message loop you can use the PostQuitMessage API from inside of it, or PostMessage outside of it. Otherwise you will need to get the thread/process ID and use the TerminateThread or TerminateProcess API, depending on if you want to kill just a thread or the entire process and all threads it has spawned. It is explained nicely by Microsoft (as with all API calls) on MSDN:

    http://msdn.microsoft.com/en-us/library/aa450927.aspx

提交回复
热议问题