I always like to put "Dialog DoEvents 1" in loop that might need to be ended from 'outside'.
In this case it seems to be the right medicine again.
On my machine (Athlon XP Home SP2) it closes OK and is immune to nasty effects from Control keys being pressed too.
(Probably could use "SLEEP 1" instead of DIALOG DOEVENTS 1..)
In this case it seems to be the right medicine again.
Code:
FUNCTION PBMAIN () AS LONG LOCAL hWin AS DWORD LOCAL Temp AS STRING GRAPHIC WINDOW "Box", 50, 50, 300, 300 TO hWin GRAPHIC ATTACH hWin, 0 GRAPHIC BOX (10, 10) - (200, 200), 0, %BLUE DO DIALOG DOEVENTS 1 '<< MOD GRAPHIC WAITKEY$ TO Temp SELECT CASE Temp CASE "" EXIT DO CASE CHR$(27) EXIT DO CASE " " TO "~" GRAPHIC PRINT Temp; CASE CHR$(13) GRAPHIC PRINT END SELECT LOOP GRAPHIC WINDOW END END FUNCTION
(Probably could use "SLEEP 1" instead of DIALOG DOEVENTS 1..)
Comment