Haim
You can try this simple example and then tell me ...
Is this much more familiar to you...
'gui-skeleton app
Include "awinh.inc"
#lookahead
INT win,win2
INT x,y,w,h,x2,y2,w2,h2
x=0:y=10:w=400:h=400
x2=410:y2=10:w2=400:h2=300
INT winstyle,wstyle2
winstyle = WS_MINMAXSIZE or WS_CLIPCHILDREN
wstyle2 = WS_MINMAXSIZE or WS_CLIPCHILDREN
INT b0ID = 100
'############################################
'############################################
'create window **************************************************
win = SetWindow("Skeleton App",x,y,w,h,0,winstyle)
'create button on win
button0 = SetButton(win,80,4,80,26,"Close Win2",0x50000000,0x200,b0ID)
'create second window
win2 = SetWindow("New Window",x2,y2,w2,h2,0,winstyle)
'****************************************************************
'/////////
Wait()
'\\\\\\\\\
Function WndProc (sys hwnd,wmsg,wparam,lparam) as sys callback
SELECT hwnd
'----------------------------------------
CASE win
'----------------------------------------
Select wmsg
CASE WM_CLOSE
DestroyWindow win
MsgBox "Quit...","End program!"
PostQuitMessage 0
CASE WM_COMMAND
controlID = LoWord(wParam) 'get control ID
notifyCode = HiWord(wParam) 'get notification message
Select controlID
CASE b0ID
If notifycode=0
MsgBox "Close New Window!","To Win2"
CloseWindow(win2)
End If
End Select
End select
'----------------------------------------
CASE win2
'-----------------------------------------
Select wmsg
CASE WM_CLOSE
DestroyWindow win2
MsgBox "Win2 Closed!","WIN2"
End select
END SELECT
RETURN Default
END FUNCTION
X