add some functions in frmWindowPreview and modMain