implement the functions in frmWindowPreview