(VFP) - Change Resolution on your Screen

Function ChangeRes
&& Author: Alexandre Hédréville
&& Cambia la resolución de la pantalla
&& Sintaxis: ChangeRes(tnWidth, tnHeight)
&& Valor devuelto: llRetVal
&& Argumentos: tnWidth, tnHeight
&& tnWidth especifica la nueva anchura de la pantalla en pixels
&& tnHeight especifica la nueva altura de la pantalla en pixels

LPARAMETERS tnWidth, tnHeight
LOCAL lnWidth, lnHeight, lnModeNum, lcDevMode
&& Valores
lnModeNum = 0
lcDevMode = REPLICATE(CHR(0), 156)
lnWidth = IIF(EMPTY(tnWidth), 800, tnWidth)
lnHeight = IIF(EMPTY(tnHeight), 600, tnHeight)
&& Instrucciones DECLARE DLL para cambiar resolución
DECLARE INTEGER EnumDisplaySettings IN Win32API ;
STRING lpszDeviceName,;
INTEGER iModeNum, ;
STRING @lpDevMode
DECLARE INTEGER ChangeDisplaySettings IN Win32API STRING @lpDevMode, INTEGER dwFlags
&& Bucle para obtener todos los modos disponibles
DO WHILE EnumDisplaySettings(NULL, lnModeNum, @lcDevMode) <> 0
lnModeNum = lnModeNum +1
ENDDO
&& Configurar la structura DevMode
lcDevMode = STUFF(lcDevMode, 41, 4, this._LongToStr(1572864))
lcDevMode = STUFF(lcDevMode, 109, 4, this._LongToStr(tnWidth))
&& Ancho
lcDevMode = STUFF(lcDevMode, 113, 4, this._LongToStr(tnHeight))
&& Alto
&& Cambiar resolucion
ChangeDisplaySettings(@lcDevMode, 1)
RETURN

Comments

Popular posts from this blog

(VFP) - Running Visual FoxPro on Linux

(VFP) - How to insert simple Progress Bar

(VFP) - How to put calendar on your vfp application