$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 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, stg$ AS STRING, rtn AS INTEGER
rtn=EnumDisplaySettings("", ENUM_CURRENT_SETTINGS, devm)
IF rtn<>0 THEN
devm.dmFields = DM_PELSWIDTH OR DM_PELSHEIGHT OR DM_BITSPERPEL
devm.dmPelsWidth = 800
devm.dmPelsHeight = 600
devm.dmBitsPerPel = 16
rtn=ChangeDisplaySettings(devm, CDS_TEST OR CDS_UPDATEREGISTRY)
IF rtn>-1 THEN
IF rtn=DISP_CHANGE_SUCCESSFUL THEN
SHOWMESSAGE("successfull")
ELSEIF rtn=DISP_CHANGE_RESTART THEN
SHOWMESSAGE("re-booting now...")
ExitWindowsEx(EWX_REBOOT ,0)
ELSE
SHOWMESSAGE("failed")
END IF
ELSE
SHOWMESSAGE("cds failed")
END IF
ELSE
SHOWMESSAGE("eds failed")
END IF
|