Board index » delphi » Changing Screen Resolution

Changing Screen Resolution

anyone got a sample of changing screenresolution
wthout any {*word*99} just the basics?

ChangeDisplaySettings(stuff, CDS_UPDATEREGISTRY);

*stuff being a dev mode
any help would be appreciated.

 

Re:Changing Screen Resolution


procedure TForm1.Button2Click(Sender: TObject);
var
  DM:TDevMode;
  Result:LongInt;
begin
  DM.dmPelsWidth:=640;
  DM.dmPelsHeight:=480;
  Result := ChangeDisplaySettings(DM,CDS_UPDATEREGISTRY);
  If Result <> DISP_CHANGE_SUCCESSFUL then
     ShowMessage('Error!')
  else
     ShowMessage('Changed');
end;

--
With best regards, Mike Shkolnik.
FIDO: 2:463/106.14
E-Mail: mshkol...@rs-ukraine.kiev.ua
        m...@woccu.freenet.kiev.ua
WEB: http://www.geocities.com/SiliconValley/Grid/3989

Shant ??? a ???? <37B814E1.A933B...@home.com> ...

Quote
>anyone got a sample of changing screenresolution
>wthout any {*word*99} just the basics?

>ChangeDisplaySettings(stuff, CDS_UPDATEREGISTRY);

>*stuff being a dev mode
>any help would be appreciated.

Re:Changing Screen Resolution


Quote
Mike Shkolnik wrote in message <7pbe8r$re...@news.lucky.net>...

I tried out the sample code mike supplied and it appears to work,
The result comes back as chaged and my screen flashes for a moment but it
doesn't actually chage my screen resolution

do i need extra code?

platform win98
d3
voodoo3 display adator

Re:Changing Screen Resolution


Hi,

try the following:

procedure ChangeRes;
var
  DM: TDevMode;
  Result1: LongInt;
begin
  DM.dmSize := SizeOf(DM);
  DM.dmPelsWidth := 1024;  // enter desired width here
  DM.dmPelsHeight := 768;  // enter desired height here
  DM.dmfields := DM_PELSHEIGHT or DM_PELSwidth;
  Result1 := ChangeDisplaySettings(DM, CDS_UPDATEREGISTRY);
  if Result1 <> DISP_CHANGE_SUCCESSFUL then
    ShowMessage('Failure')
  else
    ShowMessage('Success');
end;

I hope this will work. By the way, you must be sure the mode you are
setting is supported. From what I see, you are setting only the width
and height. The new width and height resolution may not support the
current color depth for example. I'm trying to say that the code may be
correct and still doesn't work if the new mode is not supported. Bye.

Quote
Jean Cilliers <jcc...@icon.co.za> wrote in message

news:7pgf1l$b2o$1@news.is.co.za...
Quote

> Mike Shkolnik wrote in message <7pbe8r$re...@news.lucky.net>...

> I tried out the sample code mike supplied and it appears to work,
> The result comes back as chaged and my screen flashes for a moment but
it
> doesn't actually chage my screen resolution

> do i need extra code?

> platform win98
> d3
> voodoo3 display adator

Other Threads