RE: [DUG]: Screen Size
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Rohit Gupta Sent: Monday, 12 June 2000 15:45 To: Multiple recipients of list delphi Subject: RE: [DUG]: Screen Size Jason, thanks for the effort. From the help files, I knew I could do that. My fault for not specifying the requirement. I wish my app to run in 1024X768. The current temporary solution is that it refuses to run if you are in say 800x600. What I want to do is to change the settings to 1024x768 run the program and on exit, change the system backto what it was. For this to work, 1. I need to know the exact mode number to restore to. 2. I need to know the current mode number so that I can figure out things like font size and display frequency before flipping to 1024x768... otherwise we could have sync problems. And there is no GetDisplaysettings. EnumDisplaySettings as you know gives you all the settings but I cant find anyway to know what the current setting is. I can get a few of those fields from GetSystemMetrics, but not all. You can also get some from GetDeviceCaps, such as GetDeviceCaps( Canvas.Handle, HORZRES ) GetDeviceCaps( Canvas.Handle, VERTRES ) --- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz
RE: [DUG]: Screen Size
Have you got the Tomes of Delphi 3, Win32 Graphical API? that has an example of changing the settings, I can send it if you need? Regards Jason -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Rohit Gupta Sent: Friday, 9 June 2000 2:28 p.m. To: Multiple recipients of list delphi Subject: RE: [DUG]: Screen Size We looked at that, the problem is that devmode structure requires a whole lot of info which is hard to obtain. For instance the enumdisplaysettings does not get you the current settings to feed to devmode. Instead it gives you settings for all display modes of the card. To: Multiple recipients of list delphi [EMAIL PROTECTED] Send reply to: [EMAIL PROTECTED] From: James Sugrue [EMAIL PROTECTED] Subject:RE: [DUG]: Screen Size Date sent: Thu, 8 Jun 2000 16:01:10 +1200 ChangeDisplaySettings -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, 8 June 2000 15:49 To: Multiple recipients of list delphi Subject: [DUG]: Screen Size I can get the screen size with getsystemmetrics, but how do I change the screen size ? Does anyone know ? Rohit == CFL - Computer Fanatics Ltd. 21 Barry's Point Road, AKL, New Zealand PH(649) 489-2280 FX(649) 489-2290 email [EMAIL PROTECTED] or [EMAIL PROTECTED] == -- - New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz CAUTION - This message may contain privileged and confidential information intended only for the use of the addressee(s) named above. If you are not the intended recipient of this message you a re hereby notified that any use, dissemination, distribution or reproduction of this message is proh ibited. If you have received this message in error please notify Progressive Enterprises Ltd. immediately via email at [EMAIL PROTECTED] Any views expressed in this message are those of the individual sender and may not necessarily reflect the views of Progressive Enterprises Ltd. This footnote also confirms that Progressive Enterprises Ltd. has swept this email message for th e presence of computer viruses. This does not guarantee this message is virus free. -- - New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz Rohit == CFL - Computer Fanatics Ltd. 21 Barry's Point Road, AKL, New Zealand PH(649) 489-2280 FX(649) 489-2290 email [EMAIL PROTECTED] or [EMAIL PROTECTED] == --- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz --- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz
RE: [DUG]: Screen Size
Here it is anyway! // {Whoops! Delphi imports this function incorrectly, so we must manually import it} function ChangeDisplaySettings(lpDevMode: PDeviceMode; dwFlags: DWORD): Longint; stdcall; var Form1: TForm1; DevModeArray: TList;// holds a list of device mode information structures implementation uses Math; {$R *.DFM} {import the function} function ChangeDisplaySettings; external user32 name 'ChangeDisplaySettingsA'; procedure TForm1.FormCreate(Sender: TObject); var DevModeCount: Integer;// tracks the number of display modes DevModeInfo: ^TDevMode; // a pointer to display mode information begin {create the list to hold display mode information structures} DevModeArray := TList.Create; {initialize the counter} DevModeCount := 0; {dynamically allocate memory to hold display mode information} GetMem(DevModeInfo, SizeOf(TDevMode)); {begin enumerating display modes} while EnumDisplaySettings(NIL, DevModeCount, DevModeInfo^) do begin {add the information to the list} DevModeArray.Add(DevModeInfo); {increment the counter} Inc(DevModeCount); {display the resolution of the enumerated display mode} ListBox1.Items.Add(IntToStr(DevModeInfo^.dmPelsWidth)+'x'+ IntToStr(DevModeInfo^.dmPelsHeight)+', '+ IntToStr(Trunc(IntPower(2, DevModeInfo^.dmBitsPerPel)))+ ' colors'); {allocate another slot for device mode information} GetMem(DevModeInfo, SizeOf(TDevMode)); end; {the above loop always exits with one extra, unused block of memory, so delete it} FreeMem(DevModeInfo, SizeOf(TDevMode)); {select the first item in the list box} ListBox1.ItemIndex := 0; end; procedure TForm1.FormDestroy(Sender: TObject); var iCount: Integer; // a general loop counter begin {free all memory pointed to by each item in the list} for iCount := 0 to DevModeArray.Count-1 do FreeMem(DevModeArray.Items[iCount], SizeOf(TDevMode)); {free the list} DevModeArray.Free; end; procedure TForm1.Button1Click(Sender: TObject); var ModeChange: Longint;// indicates if a Windows reboot is necessary begin {change the display mode} ModeChange:=ChangeDisplaySettings(DevModeArray[ListBox1.ItemIndex], CDS_UPDATEREGISTRY); {indicate if a dynamic change was successful or if Windows must be rebooted} if ModeChange=DISP_CHANGE_SUCCESSFUL then ShowMessage('Dynamic display mode change successful.'); if ModeChange=DISP_CHANGE_RESTART then ShowMessage('Change successful; Windows must be restarted for the changes '+ 'to take effect'); end; -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Rohit Gupta Sent: Friday, 9 June 2000 2:28 p.m. To: Multiple recipients of list delphi Subject: RE: [DUG]: Screen Size We looked at that, the problem is that devmode structure requires a whole lot of info which is hard to obtain. For instance the enumdisplaysettings does not get you the current settings to feed to devmode. Instead it gives you settings for all display modes of the card. To: Multiple recipients of list delphi [EMAIL PROTECTED] Send reply to: [EMAIL PROTECTED] From: James Sugrue [EMAIL PROTECTED] Subject:RE: [DUG]: Screen Size Date sent: Thu, 8 Jun 2000 16:01:10 +1200 ChangeDisplaySettings -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, 8 June 2000 15:49 To: Multiple recipients of list delphi Subject: [DUG]: Screen Size I can get the screen size with getsystemmetrics, but how do I change the screen size ? Does anyone know ? Rohit == CFL - Computer Fanatics Ltd. 21 Barry's Point Road, AKL, New Zealand PH(649) 489-2280 FX(649) 489-2290 email [EMAIL PROTECTED] or [EMAIL PROTECTED] == -- - New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz CAUTION - This message may contain privileged and confidential information intended only for the use of the addressee(s) named above. If you are not the intended recipient of this message you a re hereby notified that any use, dissemination, distribution or reproduction of this message is proh ibited. If you have received this message in error please notify Progressive Enterprises Ltd. immediately via email at [EMAIL PROTECTED] Any views expressed in this message are those of the individual sender and may not necessarily reflect the views of Progressive Enterprises Ltd
RE: [DUG]: Screen Size
We looked at that, the problem is that devmode structure requires a whole lot of info which is hard to obtain. For instance the enumdisplaysettings does not get you the current settings to feed to devmode. Instead it gives you settings for all display modes of the card. To: Multiple recipients of list delphi [EMAIL PROTECTED] Send reply to: [EMAIL PROTECTED] From: James Sugrue [EMAIL PROTECTED] Subject:RE: [DUG]: Screen Size Date sent: Thu, 8 Jun 2000 16:01:10 +1200 ChangeDisplaySettings -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, 8 June 2000 15:49 To: Multiple recipients of list delphi Subject: [DUG]: Screen Size I can get the screen size with getsystemmetrics, but how do I change the screen size ? Does anyone know ? Rohit == CFL - Computer Fanatics Ltd. 21 Barry's Point Road, AKL, New Zealand PH(649) 489-2280 FX(649) 489-2290 email [EMAIL PROTECTED] or [EMAIL PROTECTED] == --- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz CAUTION - This message may contain privileged and confidential information intended only for the use of the addressee(s) named above. If you are not the intended recipient of this message you a re hereby notified that any use, dissemination, distribution or reproduction of this message is proh ibited. If you have received this message in error please notify Progressive Enterprises Ltd. immediately via email at [EMAIL PROTECTED] Any views expressed in this message are those of the individual sender and may not necessarily reflect the views of Progressive Enterprises Ltd. This footnote also confirms that Progressive Enterprises Ltd. has swept this email message for th e presence of computer viruses. This does not guarantee this message is virus free. --- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz Rohit == CFL - Computer Fanatics Ltd. 21 Barry's Point Road, AKL, New Zealand PH(649) 489-2280 FX(649) 489-2290 email [EMAIL PROTECTED] or [EMAIL PROTECTED] == --- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz
RE: [DUG]: Screen Size
ChangeDisplaySettings -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, 8 June 2000 15:49 To: Multiple recipients of list delphi Subject: [DUG]: Screen Size I can get the screen size with getsystemmetrics, but how do I change the screen size ? Does anyone know ? Rohit == CFL - Computer Fanatics Ltd. 21 Barry's Point Road, AKL, New Zealand PH(649) 489-2280 FX(649) 489-2290 email [EMAIL PROTECTED] or [EMAIL PROTECTED] == --- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz CAUTION - This message may contain privileged and confidential information intended only for the use of the addressee(s) named above. If you are not the intended recipient of this message you are hereby notified that any use, dissemination, distribution or reproduction of this message is prohibited. If you have received this message in error please notify Progressive Enterprises Ltd. immediately via email at [EMAIL PROTECTED] Any views expressed in this message are those of the individual sender and may not necessarily reflect the views of Progressive Enterprises Ltd. This footnote also confirms that Progressive Enterprises Ltd. has swept this email message for the presence of computer viruses. This does not guarantee this message is virus free. --- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz