If I understand your question the problem is that when running the application you want to receive some form of signal from the user to stop. The challenge is doing this without having to "poll" the workstation looking for input.
One thing you could try would be to create a button whose CTL event is -1001 as this emulate a ESCAPE/BREAK being pressed. You can thus simply create a small window in the center of the screen with this button then have a SETESC in your code trap the event to allow for an orderly exit. If desired you could also include an animated GIF on the window to show progress to your user.
Personally though I would use the PxPlus progress bar utility and issue a call to it on a regular basis in your logic. This provides not only a means to do an orderly shutdown but also a visual indication that work is being done. There are two (2) options with PxPlus progress bars, one that allows you to display the percentage complete and one that just provides a ongoing progress display. If you know how much of the work has been done I recommend the former option (the percentage complete bar).
BTW: It should be noted that the PxPlus progress bar has built-in logic to only update the screen every few seconds instead of every time it is called. This helps overall performance which can be impacted by repeatedly screen updates.