PK tf)% ResSwitcher.txtTResSwitcher Component By Regardt Kruger mlasset@cybertrade.co.za //Please Send me a mail and tell me about updates uses etc etc //Instalation and Use: 1. Extract all the files in a folder 2. Open Delphi IDE 3. Go to | Component Menu | Install Component | 4. Click Browse... 5. Locate the ResSwitcher.pas File and select 6. Click Ok Component Will be installed under Tab: Display; Drop Component on Form. You can access the CurrentScreenHeight and CurrentScreenWidth properties of the component at run-time and determine the current Resolution. If the Current Resolution is not the desired just call the NewRes procedure ie: ResSwitcher1.NewRes(800,600,16); Simple??? Enjoy at own Risk for any Reason whatsoever!!! ;-) PK tf)ƴ~ ResSwitcher.pas//------------------------------------------------------------------------------ //TResSwitcher // //AUTHOR: Regardt Kruger // mlasset@cybertrade.co.za // //Description: Resolution Switcher was designed to ease the Switching of // Screen Resolution when running your application. Feel Free to // modify this component but please send me a e-mail with any changes} // //Disclaimer: Use this Component at own Risk for any purpose ;-) //------------------------------------------------------------------------------ unit ResSwitcher; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs; type TResSwitcher = class(Tcomponent) private cWidth : integer; cHeight : integer; protected public constructor create(AOwner : TComponent); override; procedure NewRes(iWidth,iHeight,iBit : integer); published property CurrentScreenWidth : integer read cWidth; property CurrentScreenHeight : integer read cHeight; end; procedure Register; implementation //------------------------------------------------------------------------------ { TResSwitcher } //------------------------------------------------------------------------------ constructor TResSwitcher.create(AOwner: TComponent); begin inherited create(AOwner); cWidth := Screen.Width; //Gets Current Width from Screen class cHeight := Screen.Height; //Gets Current Height from Screen class end; //------------------------------------------------------------------------------ procedure TResSwitcher.NewRes(iWidth, iHeight, iBit: integer); var DMode : TDeviceMode; begin //Initialize the following fields in TDeviceMOde DMode.dmFields := DM_BITSPERPEL or DM_PELSWIDTH or DM_PELSHEIGHT; //Set New Resolution Settings DMode.dmBitsPerPel := iBit; DMode.dmPelsWidth := iWidth; DMode.dmPelsHeight := iHeight; //Call the ChangedisplaySettings function from WinAPI with settings above if ChangeDisplaysettings(DMode,CDS_UPDATEREGISTRY) <> DISP_CHANGE_SUCCESSFUL then ChangeDisplaysettings(DMode,0); //Update the Current Width and Height properties cWidth := Screen.Width; cHeight := Screen.Height; end; //------------------------------------------------------------------------------ procedure Register; begin RegisterComponents('Display', [TResSwitcher]); end; //------------------------------------------------------------------------------ end. PK 2tf)[R ResSwitcher.dcu 2tf)