Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Registry.Prg
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00204270
Message ID:
00204532
Vues:
12
>I have downloaded Rick Strahl's Registry.prg from
>the files section.
>
>Can someone provide an example of how to use it?
* ---  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 	= lnAppState
HTH,
Nick
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform