![]() |
|
Program that won't close - Printable Version +- PowerBASIC Users Meeting Point (https://pump.richheimer.de) +-- Forum: User to User Discussions (https://pump.richheimer.de/forumdisplay.php?fid=3) +--- Forum: PowerBASIC for Windows (https://pump.richheimer.de/forumdisplay.php?fid=4) +--- Thread: Program that won't close (/showthread.php?tid=146) |
Program that won't close - Giuseppe Belziti - 25.10.2026 I have a program that I can't close; I've tried everything. Here is the current situation: Code: CALLBACK FUNCTION AggiornaXProc()Code: ' --- RICHIAMA PAY.EXE ---I also tried using taskkill, but it doesn't work. If I try from the CMD, on the other hand, I get this—and you can see that the program was open: C:\PAG>cmd.exe /c taskkill /F /IM PAY_START.EXE OPERAZIONE RIUSCITA: il processo "PAY_START.EXE" con il PID 8960 è stato terminato. Do you have a solution for closing this program safely? P.S. This only happens with this one... RE: Program that won't close - Kurt Kuzba - 25.10.2026 Should you be closing the current dialog before closing others? RE: Program that won't close - Dale Yarker - 25.10.2026 CLOSE and END in the callback??? Bad idea IMO. Without trimmed but compilable example I can't figure out if you had a good reason to do that, and no suggestions possible. hint: read END in Help! RE: Program that won't close - Jules Marchildon - 25.10.2026 I'm with Dale on this one, using it inside a message callback breaks the message loop and prevents a proper cleanup... forcing multiple DIALOG END calls inside a local callback is most likely causing you to crash before the process can exit. Another thing to look at is when you are launching PID = SHELL("PAY.EXE", 1) at practically the same time when you are destroying the parent process. You should consider restructuring your exit path, fix it by removing all of this from the callback and let the dialogs close and handle the SHELL, CLOSE, and END in your main execution loop after the DIALOG LOOP terminates. RE: Program that won't close - Mike Doty - 25.10.2026 Code: #DIM ALL 'end all if dialog1 endedRE: Program that won't close - Borje Hagsten - 25.10.2026 I don't understand the problem. First of all, %WM_SYSCOMMAND and %SC_CLOSE is only reached when you close a program via the system menu close or X in caption bar. There is nothing you can do at that point other than preventing close by returning 1 and exit in dialogs, or exit function in SDK message loop. Usually better to move closing stuff, stopping ticking timers and saving settings, etc. to %WM_DESTROY, which is reached regardless of how a program is ended. Also, when a parent dialog is closed, all child dialogs and controls are destroyed with it. No need for any extra dialog ends for child dialogs. Is it the external PAY.EXE that is the problem and if so - is that your own program? A tip is to use MS Spy to monitor messages in a program. It can tell what is happening at the end - what is missing, etc. |