Forum Discussion
7 Replies
- abdul_rpContributor
I found the solution for getting the screen resolution, But how to set in Runtime?
var d = Sys["Desktop"];ShowMessage(d["Height"]);
ShowMessage(d["Width"]);
- AlexKarasChampion Level 3
- abdul_rpContributor
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"]));
}
- AlexKarasChampion Level 3Hi Abdul,
Just a quick guess: are you sure that 64 bits/pixel is a correct value for the color depth?
(This is in the SetDisplay(1280, 1024, 64); line.)
Shouldn't it be 32 instead of 64? Or you are using 64-bit OS? - abdul_rpContributorHi Alex,
Even i have tried with 32 Bit , Here also it is not working.
Regards,
Abdul - abdul_rpContributorAlex,
Thanks . I got the solution. It should be 32 Bit as I am working 32 Bit OS.
Regards,
Abdul
Related Content
- 5 years agolingling_chiang
- 5 years agogdave
- 2 years agolhedgehog
- 11 months agoesoysal
Recent Discussions
- 3 days agoMW_Didata