Is there any way to prevent console application to close?

后端 未结 2 1170
小鲜肉
小鲜肉 2021-01-27 17:49

Is there any way to prevent console application to close ?

(that the user can\'t close the program)

2条回答
  •  半阙折子戏
    2021-01-27 18:47

    Take a look at the Win32 console API.

    You could try creating a windows (non console app) and then create your own console window with AllocConsole(). As I haven't tried this I can't say if Windows will still try to kill your process.

    An alternative would be to create a background process/service to do the work.

提交回复
热议问题