* --- Save the Screen Size and Position --- * local lnAppState, lnAppWidth, lnAppHeight, lnAppTop, lnAppLeft, lReturn lnAppState = iif(_screen.WindowState = 1, 0, _screen.WindowState) && Don't save minimized lnAppWidth = _vfp.Width lnAppHeight = _vfp.Height lnAppTop = _vfp.Top lnAppLeft = _vfp.Left lReturn = oRegistry.WriteRegistryInt(HKEY_CURRENT_USER, ; "SOFTWARE\" + REG_CNAME + "\" + REG_APPNAME + "\Application", "Width", lnAppWidth, .T.) lReturn = oRegistry.WriteRegistryInt(HKEY_CURRENT_USER, ; "SOFTWARE\" + REG_CNAME + "\" + REG_APPNAME + "\Application", "Height", lnAppHeight, .T.) lReturn = oRegistry.WriteRegistryInt(HKEY_CURRENT_USER, ; "SOFTWARE\" + REG_CNAME + "\" + REG_APPNAME + "\Application", "Top", lnAppTop, .T.) lReturn = oRegistry.WriteRegistryInt(HKEY_CURRENT_USER, ; "SOFTWARE\" + REG_CNAME + "\" + REG_APPNAME + "\Application", "Left", lnAppLeft, .T.) lReturn = oRegistry.WriteRegistryInt(HKEY_CURRENT_USER, ; "SOFTWARE\" + REG_CNAME + "\" + REG_APPNAME + "\Application", "WindowState", lnAppState, .T.) **************************************************************************** *** Restore saved application Screen size and position *** local lnAppWidth, lnAppHeight, lnAppTop, lnAppLeft, lnAppState local lnDefWidth, lnDefHeight, lnDefTop, lnDefLeft, lnDefState * Default settings for screen resolution of 800 x 600 lnDefWidth = 792 lnDefHeight = 503 lnDefTop = 0 lnDefLeft = 0 lnDefState = 0 && Normal * --- Set the Screen Size & Position --- * lnReturn = oRegistry.ReadRegistryInt(HKEY_CURRENT_USER, ; "SOFTWARE\" + REG_CNAME + "\" + REG_APPNAME + "\Application", "Width" ) lnAppWidth = iif(isnull(lnReturn), lnDefWidth, lnReturn) lnReturn = oRegistry.ReadRegistryInt(HKEY_CURRENT_USER, ; "SOFTWARE\" + REG_CNAME + "\" + REG_APPNAME + "\Application", "Height" ) lnAppHeight = iif(isnull(lnReturn), lnDefHeight, lnReturn) lnReturn = oRegistry.ReadRegistryInt(HKEY_CURRENT_USER, ; "SOFTWARE\" + REG_CNAME + "\" + REG_APPNAME + "\Application", "Top" ) lnAppTop = iif(isnull(lnReturn), lnDefTop, lnReturn) lnReturn = oRegistry.ReadRegistryInt(HKEY_CURRENT_USER, ; "SOFTWARE\" + REG_CNAME + "\" + REG_APPNAME + "\Application", "Left" ) lnAppLeft = iif(isnull(lnReturn), lnDefLeft, lnReturn) lnReturn = oRegistry.ReadRegistryInt(HKEY_CURRENT_USER, ; "SOFTWARE\" + REG_CNAME + "\" + REG_APPNAME + "\Application", "WindowState" ) lnAppState = iif(isnull(lnReturn), lnDefState, lnReturn) _vfp.Width = lnAppWidth _vfp.Height = lnAppHeight _vfp.Top = lnAppTop _vfp.Left = lnAppLeft _screen.WindowState = lnAppStateHTH,