Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to change screen resolution ?

Status
Not open for further replies.

Spent

Programmer
Mar 20, 2003
100
BG
Can Anyone tell me how to change screen resolution on
Form.Create Event .I want to make my application to change the resolution OnCreate and restore the previous resolution OnClose
Thanks

Spent
mail:spentbg@yahoo.com
 
i dont know if you can.
what if your app tried to set a resolution that the clients pc couldnt handle.

it isnt normal programming practice to change the pc to suit your app, you should set your app to suit the pc.


Aaron Taylor
John Mutch Electronics
 
As aaronjme points out, this is probably not a good idea, but this might work (I don't know if it's intended for win9x or winnt or both).

ripped off from google newsgroups:

function NewRes(XRes,YRes:DWord):integer;
var
DevMode:TDeviceMode;
begin
EnumDisplaySettings(nil, 0, DevMode);
DevMode.dmFields:=DM_PELSWIDTH or DM_PELSHEIGHT;
DevMode.dmPelsWidth:=XRes;
DevMode.dmPelsHeight:=YRes;
Result:=ChangeDisplaySettings(DevMode, 0);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
if NewRes(1024,768)=DISP_CHANGE_SUCCESSFUL then
begin
ShowMessage('Resolution changed.');
end;
end;


Brian
"There are 2 kinds of people in the world, those that divide people into two groups and those that don't. I belong to the second group." - tag line I stole
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top