Forum Discussion
Hi,
Following code is not changing the system Resolution , can you let me what could be the problem with the code.
function SetDisplay(x,y,d)
{
var dm, dwLastError;
res = -1;
dm = Win32API["DEVMODE"]();
if(Win32API["EnumDisplaySettings"](VarToInteger(0), -1, dm) != 0)
{
dm["dmPelsWidth"] = x;
dm["dmPelsHeight"] = y;
dm["dmBitsPerPel"] = d;
res = Win32API["ChangeDisplaySettings"](dm, 0);
}
else
{
dwLastError = Win32API["GetLastError"]();
Log["Error"]("Error code: " + VarToStr(dwLastError));
}
return res
}
function TestSetDisplay()
{
// SetDisplay(1024, 768, 32);
//
// Log["Message"]("New resolution: " + VarToStr(Sys["Desktop"]["Width"]) +
//
// "x"+VarToStr(Sys["Desktop"]["Height"]));
//Delay(2000);
SetDisplay(1280, 1024, 64);
Log["Message"]("New resolution: " + VarToStr(Sys["Desktop"]["Width"]) +
"x"+VarToStr(Sys["Desktop"]["Height"]));
}