!!! YA ESTA SOLUCIONADO ¡¡¡
En primer lugar comentar que la función original ChangeRes corresponde a los brasileiros Marcelo Gomes y Yuri Marcelino, y se encuentra en el foro de FW-Brasil:
http://www.fivewin.com.br/forum/topic.a ... C_ID=10465
En segundo lugar que en base a dicha función, he elaborado la función CamReso() para xHarbour, que cambia la resolución de la pantalla y automaticamente vuelve a la resolución original al cerrar la aplicación. A mi me funciona perfectamente.
¿Cual es mi método?
1) FUNCTION MAIN()
LOCAL nResoAncho := GetSysMetrics(0)
......
......
IF nResoAncho > 800
IF MSGYESNO("Este programa está diseñado para una resolución de pantalla"+CRLF+;
"de 800 x 600." +CRLF+CRLF+;
"Al estar configurada la resolución de su monitor a una mayor,"+CRLF+;
"verá las ventanas y mensajes bastantes mas pequeños."+CRLF+CRLF+;
"¿DESEA MODIFICAR LA RESOLUCION DE SU PANTALLA?.","NOMBRE DEL PROGRAMA")
CamReso ( 800, 600, .f. )
ENDI
ENDI
....
....
y esta es la función:
///////////////////////////////////////////////////////////////////
/// FUNCION CamReso
/// CAMBIA RESOLUCION DE PANTALLA TEMPORALMENTE
/// Manuel Valdenebro 2008
/// Adaptación ChangeRes() Marcelo Gomes/Yuri Marcelino
///
http://www.fivewin.com.br/forum/topic.a ... C_ID=10465
/// ---------------------------------------
// nAncho ancho pantalla
// nAlto alto pantalla
// lPreguntar si pregunta antes de realizar el cambio
///////////////////////////////////////////////////////////////////
#Include "dll.ch"
#Include "Struct.ch"
Function CamReso(nAncho, nAlto, lPreguntar)
Local DM_PELSWIDTH := nHex("80000")
Local DM_PELSHEIGHT := nHex("100000")
Local oDevMode
Local lPosible
Local cBuffer
Local lCamReso := .f.
DEFAULT nAncho := GetSysMetrics(0), ;
nAlto := GetSysMetrics(1), ;
lPreguntar := .t.
STRUCT oDevMode
MEMBER cDevName AS STRING LEN 32
MEMBER nSpecVer AS WORD
MEMBER nDrvVer AS WORD
MEMBER nSize AS WORD
MEMBER nDrvExtra AS WORD
MEMBER nFields AS DWORD
MEMBER nOrientat AS WORD
MEMBER nPaperSiz AS WORD
MEMBER nPaperLen AS WORD
MEMBER nPaperWid AS WORD
MEMBER nScale AS WORD
MEMBER nCopies AS WORD
MEMBER nDefSrc AS WORD
MEMBER nPrnQlty AS WORD
MEMBER nColor AS WORD
MEMBER nDuplex AS WORD
MEMBER nYResolut AS WORD
MEMBER nTTOpt AS WORD
MEMBER nCollate AS WORD
MEMBER cFormName AS STRING LEN 32
MEMBER nUnusePad AS WORD
MEMBER nBitsPPel AS DWORD
MEMBER nPelWidth AS DWORD
MEMBER nPelHeigh AS DWORD
MEMBER nDisFlags AS DWORD
MEMBER nDisFreq AS DWORD
ENDSTRUCT
cBuffer := oDevMode:cBuffer
// Comprueba si es posible cambiar la resolución
lPosible := EnumDisplaySettings(0, 0, @cBuffer)
// Si es posible cambiar la resolución
IF lPosible
if lPreguntar
if MsgYesNo("Desea cambiar la resolución?", "Atención")
else
RETURN lCamReso
endif
endi
oDevMode:nFields := nOr(DM_PELSWIDTH, DM_PELSHEIGHT )
oDevMode:nPelWidth := nAncho
oDevMode:nPelHeigh := nAlto
cBuffer:=oDevMode:cBuffer
TRY
ChangeDisplaySettings(@cBuffer, 4)
lCamReso := .T.
CATCH
MsgAlert("Modo no soportado", "Error" )
END
else
MsgAlert("Modo no soportado", "Error" )
endif
return lCamReso
DLL32 FUNCTION EnumDisplaySettings(lpszDeviceName AS DWORD,;
iModeNum AS DWORD, ;
@lpDevMode AS LPSTR) AS BOOL PASCAL;
FROM "EnumDisplaySettingsA" LIB "User32.dll"
DLL32 FUNCTION ChangeDisplaySettings(@lpDevMode AS LPSTR,;
dwFlags AS DWORD) AS DWORD;
FROM "ChangeDisplaySettingsA" LIB "User32.dll"
DLL32 FUNCTION ExitWindowsEx(uFlags AS DWORD,;
dwReserved AS DWORD) AS DWORD PASCAL;
LIB "user32.dll"
------------------------------------------------------------