UserMessages $10 Def CloseDlg(1) (%umessage = $10) And (GetActiveWindow() = &(1)) Cls Var dlg& = Create("Dialog",%hwnd,"Dialog",600,500,400,300) While 1 WaitInput If CloseDlg(%hwnd) Break ElseIf CloseDlg(dlg&) DestroyWindow(dlg&) EndIf EndWhile end