Is there a "reboot" function in Windows / C ++

In the windows project I'm working on, I intend to have a menu selection that copies the application. Is there a windows or c ++ function that does this?

+3
source share
6 answers

There is no built-in device for this, but a well-designed application can simply stop everything that happens and then return to the beginning. If you need a real “new start”, you will need to create a new process (perhaps as the last thing you do before the old one shuts down.)

+3
source

, . , , , , .

+2

API- Restart Manager, Windows Vista. , p- , Visual ++ 2010.

+1

. - .bat ( ), , bat .

bat ...

0

Do you want to call CreateProcess and then close the current instance of the application using ExitProcess () , or if you reference the C runtime, just return from main (). But first you have to ask yourself why you need to recreate the process in the first place.

0
source

ExitWindowsEx is what you want. You can also run the shutdown.exe utility built into the windows.

shutdown -t0 -r (restart the system after 0 seconds)
-3
source

Source: https://habr.com/ru/post/1718329/


All Articles