Here's a snippet which closes any window using its title:
/* Commented by KSV: Definitions of external functions */
PROCEDURE GetWindow EXTERNAL "user32":
DEF INPUT PARAM h AS LONG.
DEF INPUT PARAM d AS LONG.
DEF RETURN PARAM h2 AS LONG.
END.
PROCEDURE GetWindowTextA EXTERNAL "user32":
DEF INPUT PARAM h AS LONG.
DEF INPUT PARAM m AS MEMPTR.
DEF INPUT PARAM s AS LONG.
END.
PROCEDURE GetDesktopWindow EXTERNAL "user32":
DEF RETURN PARAM h AS LONG.
END.
PROCEDURE SendMessageA EXTERNAL "user32":
DEF INPUT PARAM h AS LONG.
DEF INPUT PARAM m AS LONG.
DEF INPUT PARAM w AS LONG.
DEF INPUT PARAM l AS LONG.
END.
/* Commented by KSV: Main block */
DEFINE VARIABLE GW_CHILD AS INTEGER INIT 5 NO-UNDO.
DEFINE VARIABLE GW_HWNDNEXT AS INTEGER INIT 2 NO-UNDO.
DEFINE VARIABLE WM_CLOSE AS INTEGER INIT 16 NO-UNDO.
DEFINE VARIABLE hPrev AS INTEGER NO-UNDO.
DEFINE VARIABLE hNext AS INTEGER NO-UNDO.
DEF VAR m AS MEMPTR.
DEFINE VARIABLE s AS CHARACTER NO-UNDO.
/* Commented by KSV: Get the desktop window handle */
RUN GetDesktopWindow(OUTPUT hPrev).
/* Commented by KSV: Get the first child */
RUN GetWindow(hPrev,GW_CHILD,OUTPUT hNext).
/* Commented by KSV: Looping for all windows */
LOOP:
DO WHILE hNext <> 0:
hPrev = hNext.
/* Commented by KSV: Get the next window handle */
RUN GetWindow(hPrev,GW_HWNDNEXT,OUTPUT hNext).
/* Commented by KSV: Read the window title */
RUN GetWindowTextA(hNext,m,256).
s = GET-STRING(m,1).
/* Commented by KSV: Compare titles of two windows, if they're the
** same, send the close signal to window */
IF s = "<Your window title>" THEN
RUN SendMessageA(hNext,WM_CLOSE,0,0).
END.