Actually, that won’t work as intended, because the program will sto .. dle of whatever was do .. the time, not at an appropriat .. ping point.
The process will need to be processing Windows messages timely, in addition to doing what it’s regularly doing, which pretty much calls for a secondary thread to do the work while the primary thread listens for mouse-moves and keystrokes. When a stop-signal is received, a shared flag needs to be raised which the other thread continually checks at appropriate times, whatever “appropriate” may mean to this procedure. Then, it must suspend itself without busy-waiting or timing holes. Not trivial.
By “appropriate,” I mean for example, “stop after processing the file that you are currently processing.” Flipping the main power switch on-and-off won’t do that.