$INCLUDE "RAPIDQ.INC"
$OPTIMIZE ON
$TYPECHECK ON
$ESCAPECHARS ON
CONST EWX_LOGOFF = 0
CONST EWX_SHUTDOWN = 1
CONST EWX_REBOOT = 2
CONST EWX_FORCE = 4
CONST DM_BITSPERPEL = &H40000
CONST DM_PELSWIDTH = &H80000
CONST DM_PELSHEIGHT = &H100000
CONST DM_DISPLAYFREQUENCY = &H400000
CONST CDS_DYNAMIC = &H0
CONST CDS_UPDATEREGISTRY = &H1
CONST CDS_TEST = &H4
CONST CDS_FULLSCREEN = &H4
CONST CDS_GLOBAL = &H8
CONST CDS_SET_PRIMARY = &H10
CONST CDS_RESET = &H40000000
CONST CDS_SETRECT = &H20000000
CONST CDS_NORESET = &H10000000
CONST DISP_CHANGE_SUCCESSFUL = 0
CONST DISP_CHANGE_RESTART = 1
CONST DISP_CHANGE_FAILED = -1
CONST DISP_CHANGE_BADMODE = -2
CONST DISP_CHANGE_NOTUPDATED = -3
CONST DISP_CHANGE_BADFLAGS = -4
CONST DISP_CHANGE_BADPARAM = -5
CONST ENUM_CURRENT_SETTINGS = -1
CONST ENUM_REGISTRY_SETTINGS = -2
CONST STRING_SIZE=32
TYPE DEVMODE
dmDeviceName AS STRING * STRING_SIZE
dmSpecVersion AS WORD
dmDriverVersion AS WORD
dmSize AS WORD
dmDriverExtra AS WORD
dmFields AS DWORD
dmOrientation AS SHORT
dmPaperSize AS SHORT
dmPaperLength AS SHORT
dmPaperWidth AS SHORT
dmScale AS SHORT
dmCopies AS SHORT
dmDefaultSource AS SHORT
dmPrintQuality AS SHORT
dmColor AS SHORT
dmDuplex AS SHORT
dmYResolution AS SHORT
dmTTOption AS SHORT
dmCollate AS SHORT
dmFormName AS STRING * STRING_SIZE
dmLogPixels AS WORD
dmBitsPerPel AS DWORD
dmPelsWidth AS DWORD
dmPelsHeight AS DWORD
dmDisplayFlags AS DWORD
dmDisplayFrequency AS DWORD
END TYPE
DECLARE FUNCTION EnumDisplaySettings LIB "user32" ALIAS "EnumDisplaySettingsA" (BYVAL lpszDeviceName AS LONG, BYVAL iModeNum AS LONG, lpDevMode AS LONG) AS LONG
DECLARE FUNCTION ChangeDisplaySettings LIB "user32" ALIAS "ChangeDisplaySettingsA" (lpDevMode AS LONG, BYVAL dwFlags AS LONG) AS LONG
DECLARE FUNCTION ExitWindowsEx LIB "user32" ALIAS "ExitWindowsEx" (BYVAL uFlags AS LONG, BYVAL dwReserved AS LONG) AS LONG
DIM devm AS DEVMODE
DIM stg$ AS STRING, rtn AS INTEGER
DIM OldX AS DWORD, OldY AS DWORD
DIM OldBitsPerPel AS DWORD
DIM OldDisplayFrequency AS DWORD
rtn=EnumDisplaySettings("", ENUM_CURRENT_SETTINGS, devm)
IF rtn = DISP_CHANGE_FAILED THEN SHOWMESSAGE("eds failed" + STR$(rtn)): END
OldX = devM.dmPelsWidth
OldY = devM.dmPelsHeight
OldBitsPerPel = devM.dmBitsPerPel
OldDisplayFrequency = devM.dmDisplayFrequency
devm.dmFields = DM_PELSWIDTH OR DM_PELSHEIGHT OR DM_BITSPERPEL OR DM_DISPLAYFREQUENCY
devm.dmPelsWidth = 1152
devm.dmPelsHeight = 864
devm.dmBitsPerPel = 8
devm.dmDisplayFrequency = 70
rtn=ChangeDisplaySettings(devm, CDS_DYNAMIC)
SLEEP 5
SHOWMESSAGE "ready to revert"
IF rtn>-1 THEN
IF rtn=DISP_CHANGE_SUCCESSFUL THEN
SHOWMESSAGE("successfull")
devM.dmPelsWidth = OldX
devM.dmPelsHeight = OldY
devM.dmBitsPerPel = OldBitsPerPel
devM.dmDisplayFrequency = OldDisplayFrequency
devm.dmFields = DM_PELSWIDTH OR DM_PELSHEIGHT OR DM_BITSPERPEL OR DM_DISPLAYFREQUENCY
rtn=ChangeDisplaySettings(devm, CDS_DYNAMIC)
ELSE
SHOWMESSAGE("failed")
END IF
ELSE
SHOWMESSAGE("cds failed")
END IF
|