Question : How to close vfp report preview window programatically

I have a vfp application that logout users automatically after a specified time. It closes all open windows before logging the user out. It works fine except when a report is being previewed.
How do i close the report being previewed

Answer : How to close vfp report preview window programatically

I've been testing Win32 API with almost no success... It seems the easiest solution is to display the report preview in a form which is controlled by timer:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
of = CREATEOBJECT("TimedForm")
of.width = _screen.width
of.height = _screen.height
of.visible = .T.

REPORT FORM  PREVIEW IN WINDOW TimedForm

DEFINE CLASS TimedForm AS Form

PROCEDURE Init
  THIS.AddObject("Timer","Timer5000")
ENDPROC

ENDDEFINE

DEFINE CLASS Timer5000 AS Timer
Interval = 5000
PROCEDURE Timer
  THISFORM.Release
ENDPROC
ENDDEFINE
Random Solutions  
 
programming4us programming4us