Como en este ejemplo Jimmy. El problema es que funciona en WINDOWS 7, pero no funciona en WINDOWS 10, ¿Comprendes?
- Code: Select all Expand view RUN
// C:\FWH..\SAMPLES\RESOLU2.PRG
#include 'fivewin.ch'
#Include "dll.ch"
#Include "Struct.ch"
FUNCTION MAIN()
LOCAL nResoAncho := GetSysMetrics(0)
IF nResoAncho < 1280 .OR. nResoAncho > 1280
// CamReso( 800, 600)
CamReso( 1280, 768)
MSGINFO('HECHO. AQUI PUEDES INICIAR TU PROGRAMA ELABORADO PARA 1280 X 768')
ENDIF
RETU nil
Function CamReso( nAncho, nAlto )
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)
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
lPosible := EnumDisplaySettings(0, 0, @cBuffer)
IF lPosible
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 STATIC FUNCTION ChangeDisplaySettings(@lpDevMode AS LPSTR,;
dwFlags AS DWORD) AS DWORD PASCAL;
FROM "ChangeDisplaySettingsA" LIB "User32.dll"
DLL32 FUNCTION ExitWindowsEx(uFlags AS DWORD,;
dwReserved AS DWORD) AS DWORD PASCAL;
LIB "user32.dll"
// FIN
Regards, saludos