03-01-2010, 07:38 PM
out DisplaySettings(32 1024 768)
On my computer returns 1 when successful.
If you want to help to debug this:
Create this function and call it instead of DisplaySettings. What it shows in QM output when successfully changes display settings?
Function DisplaySettings2
On my computer returns 1 when successful.
If you want to help to debug this:
Create this function and call it instead of DisplaySettings. What it shows in QM output when successfully changes display settings?
Function DisplaySettings2
function! [colorbits] [xpixels] [ypixels]
def CCHDEVICENAME 32
def CCHFORMNAME 32
def CDS_UPDATEREGISTRY 0x00000001
def DM_BITSPERPEL 0x00040000
def DM_PELSWIDTH 0x00080000
def DM_PELSHEIGHT 0x00100000
def DISP_CHANGE_SUCCESSFUL 0
def DISP_CHANGE_RESTART 1
type DEVMODE !dmDeviceName[CCHDEVICENAME] @dmSpecVersion @dmDriverVersion @dmSize @dmDriverExtra dmFields @dmOrientation @dmPaperSize @dmPaperLength @dmPaperWidth @dmScale @dmCopies @dmDefaultSource @dmPrintQuality @dmColor @dmDuplex @dmYResolution @dmTTOption @dmCollate !dmFormName[CCHFORMNAME] @dmUnusedPadding @dmBitsPerPel dmPelsWidth dmPelsHeight dmDisplayFlags dmDisplayFrequency
dll user32
,#EnumDisplaySettings $lpszDeviceName iModeNum DEVMODE*lpDevMode
,#ChangeDisplaySettings DEVMODE*lpDevMode dwflags
DEVMODE d
int i
for i 0 1000
,if(EnumDisplaySettings(0 i &d)=0) break
,if(colorbits=0 and xpixels=0 and ypixels=0)
,,out "colorbits=%i xpixels=%i ypixels=%i" d.dmBitsPerPel d.dmPelsWidth d.dmPelsHeight
,,continue
,if((colorbits=0 or colorbits=d.dmBitsPerPel) and (xpixels=0 or xpixels=d.dmPelsWidth) and (ypixels=0 or ypixels=d.dmPelsHeight))
,,d.dmFields=0
,,if(colorbits) d.dmFields|DM_BITSPERPEL
,,if(xpixels) d.dmFields|DM_PELSWIDTH
,,if(ypixels) d.dmFields|DM_PELSHEIGHT
,,i=ChangeDisplaySettings(&d CDS_UPDATEREGISTRY)
,,out "ChangeDisplaySettings returned %i" i
,,if(i=DISP_CHANGE_SUCCESSFUL) ret 1
,,if(i=DISP_CHANGE_RESTART) mes "Display settings will be changed after you restart computer." "Display Settings" "i"
,,ret