Loop While Asc(Canvas_WaitKey) <> 27 Or IsWindow(hwnd) = True
means
loop while either esc is not pressed or while the window exists
you would have to do both to exit:
close the window and then press esc to meet the exit-condition.
Suggest, try one of these:
' 1.
Do
'...
If Not IsWIndow(hWnd) Then Exit Do
Loop While Asc(Canvas_WaitKey) <> 27
'2.
Do
'...
Loop While All( Asc(Canvas_WaitKey) <> 27, IsWindow(hwnd) )
If you use tB-version 1.9.16.16 there may possibly be some
>> bug in Do-Loop While-Syntax <<
i would prefer another syntax currently:
'3.
Do
'...
Loop Until Asc(Canvas_WaitKey) = 27 Or IsWindow(hwnd) = False
'4.
Do While IsWIndow(hWnd)
'...
Loop Until Asc(Canvas_WaitKey) = 27
'5. you could as well use While-Wend:
While IsWIndow(hWnd)
'...
If Asc(Canvas_WaitKey) = 27 Then Exit While
Wend
'6.
While All( Asc(Canvas_WaitKey) <> 27, IsWindow(hwnd) )
'...
Wend
'7. or use Repeat-Until:
Repeat
'... be aware there's no "Exit Repeat"
Until Asc(Canvas_WaitKey) = 27 Or IsWindow(hwnd) = False
Bookmarks