Have you tried using the keystoke event instead?
Should prove more system-friendly.
See if this helps ...
Should prove more system-friendly.
See if this helps ...
;Make a simple window window=CreateWindow("",50,50,200,200,0,7) menu=WindowMenu(window) menu1=CreateMenu("Test",1,menu) menu1_1=CreateMenu("Start loop",11,menu1) UpdateWindowMenu window Global workarea=CreateCanvas(0,0,200,200,window) SetBuffer CanvasBuffer(workarea) ClsColor 0,0,0 Cls Color 255,255,255 ;Event loop - only two will do for the purpose of this example While WaitEvent() Select EventID() Case $803 End Case $1001 If EventData()=11 Then doloop() End Select Wend ;Slow operation involving lots of calculation ;but interruptible by ESC Function doloop() FlushEvents For i=0 To 100000 ;Show that the operation is actually doing something If (i Mod 100)=0 Cls Text 20,20,Str(i) FlipCanvas workarea EndIf For j=0 To 100000 k=i*j Next If WaitEvent(1)=$103 ; keystroke If EventData()=27 ; [ESC] key FlushEvents Cls Text 20,20,"Interrupted" FlipCanvas workarea Exit EndIf EndIf Next End Function