I am trying to use API DestroyWindow
to auto close an active window.

in a timer,
Dim hwnd as long
hwnd=GetforegroundWindow
call DestroyWindow(hwnd)

It does not work, but if use CloseWindow
in place of DestroyEindow, it works except
it just minimizes the wind.
Do I miss something?
Thanks for any help.