Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Screen resolution
Message
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01624301
Message ID:
01624316
Vues:
65
I used a code for that, you need to adjust to your own situation.
It makes use of Struct.VCX and WinStruct.vcx libraries.
PROCEDURE ScreenResolution
*
*-- The parameter is the width of the screen in pixels.
LPARAMETERS tnResolution
*
*-- We use the following two libraries: One to 
*-- get the available display settings (not that
*-- we are interested in that, but we need to create
*-- the structure).
*-- The other to change the setting. If the change fails,
*-- it will just not take the change into effect.
*
Declare Integer EnumDisplaySettings in Win32API ;
	String lpszDeviceName, ;
	Integer iModeNum, ;
	String @lpDevMode
*
Declare Integer ChangeDisplaySettings in Win32API ;
	String @lpDevMode, ;
	Integer dwflags
*
*-- Two class libraries, from FoxCode.COM.
*
Set ClassLib to Struct, WinStruct Additive
loStruct = NEWOBJECT("DevMode")
*
*-- First create the structure using the current
*-- display setting.
Local lcDMCurrent
loStruct.dmSize = loStruct.SizeOf()
loStruct.dmDriverExtra = 0
lcDMCurrent = loStruct.GetString()
EnumDisplaySettings( NULL, -1, @lcDMCurrent)
loStruct.SetString( m.lcDMCurrent)
lnCurrentWidth = loStruct.dmPelsWidth
*
*-- Now search in the available settings for the one
*-- that we wanted to set. We find the match by comparing
*-- the display width in pixels with the parameter.
Local lnMode, lcDevMode, lnOK, lnLastColor
lnMode = 0
lcDevMode = loStruct.GetString()
lnLastColor = 0
Do While .T.
	m.lnOK = EnumDisplaySettings( NULL, m.lnMode, @lcDevMode )
	loStruct.SetString( m.lcDevMode)
	IF loStruct.dmPelsWidth = tnResolution AND ;
			loStruct.dmBitsPerPel = 32
		lcDMCurrent = loStruct.GetString()
	ENDIF
	*	
	If m.lnOK == 0
		*-- That means we had the last available one.
		Exit
	Endif
	*
	*-- Check the next higher one.
	lnMode = m.lnMode + 1
Enddo
*
loStruct.SetString( m.lcDMCurrent)
#DEFINE DM_BITSPERPEL       0x00040000
#DEFINE DM_PELSWIDTH        0x00080000
#DEFINE DM_PELSHEIGHT       0x00100000
loStruct.dmFields = DM_BITSPERPEL + DM_PELSWIDTH + DM_PELSHEIGHT
lcDMCurrent = loStruct.GetString()
ChangeDisplaySettings( @lcDMCurrent, 0 )
Hope that helps.

>Just bought new mini laptop 13.3 with optimal screen resolution 1920x1080. However I need to change that setting to 1280x800 to view all data in VFP window.
>
>Is there an initial setting I can change in VFP settings or set up programmatically so that when I start VFP it will change the screen resolution to 1280x800 either for VFP alone or for the whole laptop configuration.
>
>tnx k
Christian Isberner
Software Consultant
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform