To buy the source code of this component, please go to http://members.lycos.co.uk/dgalaxy/monsett.html

Properties
AutoOn
AutoOnInterval
ShowSettingsDialog
ShowWPaperDialog
Methods
ChangeWallPaper
GetDisplaySettings
GetVideoModes
MonOff
MonOn
StartConfig
StartCPL
StartSCR
Events
BeforeChangeSettings
BeforeChangeWPaper
BeforeMonOff
BeforeStartCPL
BeforeStartSCR
onEmptyWPaper
OnWPaperNotFound
OnWrongDisplayConfig

Properties


AutoOn: boolean
   When the MonOff method is called, the monitor is turned off. If AutoOn=true, then the monitor will be turned ON automatically after X miliseconds. X is the value set trough the AutoOnInterval property.
AutoOnInterval: integer
   Specifies the number of miliseconds after which the monitor will be turned on automatically, after the MonOff method was called. The monitor is turned on automatically only if AutoOn=true.
ShowSettingsDialog: boolean
   If this property is set to TRUE, a default dialog form appears when the StartConfig method is called. If you wish to use your own interface, this property must be set to FALSE. In this case, before you call the StartConfig method, the msWidth, msHeight,msBitsPerPels and msVertRes public variables of the component must be set:
Variable Description Accepted values
msWidth Specifies the width in pixels of the desired resolution 640, 800, 1024, 1152, 1280, 1600, ...
msHeight Specifies the height in pixels of the desired resolution 480, 600, 768, 864, 1024, 1200, ...
msBitsPerPels Specifies the number of bits/pixels (ColorDepth) 8,16,32
msVertRes Specify the desired vertical frequency 60, 70, 72, 75, 85, ...
Before the display settings are actually changed, the components tests if your hardware supports the provided settings, otherwise the changes are not made.
ShowWPaperDialog: boolean
   If this property is set to TRUE, a default dialogform appears when the ChangeWallPaper method is called. If you wish to use your own dialogform, you must set this property to FALSE. In this case the wPaperPath and wPaperStyle public variables must be set before calling the ChangeWallPaper method
Variable Description Accepted values
wPaperPath Specifies the path to the selected image a valid path to an existing image
wpaperStyle Specifies the style how the wallpaper will be displayed _center, _stretch, _tile

Methods


procedure ChangeWallPaper;

This method is called to change the wallpaper of the desktop. Before changing the wallpaper, the BeforeChangeWPaper event is fired.
If the wPaperPath contains an empty string, the onEmptyWPaper event is fired.
If the wPaperPath is not a valid path, or the specified file doesn't exists, the OnWPaperNotFound event is fired.

Usage:
with the default dialogform (ShowSettingsDialog=true):
ChangeWallPaper;

without the default dialogform (ShowSettingsDialog=false):
HiddenMonSett1.wPaperPath:='C:\PICURE.JPG';
HiddenMonSett1.wPaperStyle:=_stretch;
HiddenMonSett1.ChangeWallPaper;

procedure GetDisplaySettings;

This method is used to get the curent display settings. After the execution, the display settings will be found in the dSettings variable

Usage:
HiddenMonSett1.GetDisplaySettings;
Label1.Caption:='Resolution: '+IntToStr(HiddenMonSett1.dSettings.Height)+'*'+IntToStr(HiddenMonSett1.dSettings.Width);
Label2.Caption:='BitsPerPixels: '+IntToStr(HiddenMonSett1.dSettings.BitsPerPels);
Label3.Caption:='Vertical resolution: '+IntToStr(HiddenMonSett1.dSettings.VertRez);


procedure GetVideoModes;

This method is used to list all the supported video modes by your hardware. The list of the video modes will be returned in the vModes: TStringList variable. Each line of this StringList will represent a sepparate video mode, in the following format:
Width-Height-colorDepth-VerticalFrequency

Usage:
HiddenMonSett1.GetVideoModes;
Memo1.Clear;
Memo1.Lines:=HiddenMonSett1.vModes;
procedure MonOff;

This method is used to turn off the monitor. If the AutoOn property is set to true, the monitor wil be turned on after X miliseconds, X being specified by the AutoOnInterval property;
Before the component tries to turn off the monitor, the BeforeMonOff event is fired.
procedure MonOn;

This method is used to turn back on the monitor.


procedure StartConfig;

This method is used to change the display settings. If the ShowSettingsDialog property is true, the component will display a dialog form in which the user can specify the desired settings. Otherwise, you may use your own configuration form, and set the msWidth, msHeight,msBitsPerPels and msVertRes variabels before you call the StartConfig method. The component will check if the selected settings are supported by your hardware.
Before the settings are actually changed, the BeforeChangeSettings event is called.

Usage:

With the default configuration form (ShowSettingsDialog=true):
HiddenMonSett1.StartConfig;


Without the default configuration form (ShowSettingsDialog=false):
HiddenMonSett1.msWidth:=800;
HiddenMonSett1.msHeight:=600;
HiddenMonSett1.msBitsPerPels:=32;
HiddenMonSett1.msVertRes:=75;
HiddenMonSett1.StartConfig;


procedure StartCPL;

This method is used to start the Windows Display Settings control panel applet.


procedure StartSCR;

This method is used to start the default screensaver.


Events


property BeforeChangeSettings(Sender: TObject; var Allow: Boolean);

This event is fired when the StartConfig method is called. If Allow=false, the component will not change the current display settings.

Usage:
procedure TForm1.HiddenMonSett1BeforeChangeSettings(Sender: TObject; var Allow: Boolean);
begin
  Allow:=MessageDlg('Are you sure you want to change the current display settings?', mtConfirmation,[mbYes,mbNo],0)=mrYes;
end;

property BeforeChangeWPaper(Sender: TObject; var Allow: Boolean);

This event is fired when the ChangeWallPaper method is called. If Allow=false, the component will not change the current wallpaper.

Usage:
procedure TForm1.HiddenMonSett1BeforeChangeWPaper(Sender: TObject; var Allow: Boolean);
begin
  Allow:=MessageDlg('Are you sure you want to change the current wallpaper?', mtConfirmation,[mbYes,mbNo],0)=mrYes;
end;

property BeforeMonOff(Sender: TObject; var Allow: Boolean);

This event is fired when the MonOff method is called. If Allow=false, the component will not turn the monitor off.

Usage:
procedure TForm1.HiddenMonSett1BeforeMonOff(Sender: TObject; var Allow: Boolean);
begin
  Allow:=MessageDlg('Are you sure you want to turn off the monitor?', mtConfirmation,[mbYes,mbNo],0)=mrYes;
end;

property BeforeStartCPL(Sender: TObject; var Allow: Boolean);

This event is fired when the StartCPL method is called. If Allow=false, the component will not start the Display Settings control panel applet.

Usage:
procedure TForm1.HiddenMonSett1BeforeStartCPL(Sender: TObject; var Allow: Boolean);
begin
  Allow:=MessageDlg('Are you sure you want to start the Display Settings?', mtConfirmation,[mbYes,mbNo],0)=mrYes;
end;

property BeforeStartSCR(Sender: TObject; var Allow: Boolean);

This event is fired when the StartSCR method is called. If Allow=false, the component will not start the default screensaver.

Usage:
procedure TForm1.HiddenMonSett1BeforeStartSCR(Sender: TObject; var Allow: Boolean);
begin
  Allow:=MessageDlg('Are you sure you want to start the default screensaver?', mtConfirmation,[mbYes,mbNo],0)=mrYes;
end;

property onEmptyWPaper(Sender: TObject);

This event is fired when the ChangeWallPaper method is called, and the wPaperPath contains an empty string.
property onWPaperNotFound(Sender: TObject);

This event is fired when the ChangeWallPaper method is called, and the wPaperPath contains a path to a file which does not exists.
property onWrongDisplayConfig(Sender: TObject);

This event is fired when the StartConfig method is called, but your hardware does not support the cinfiguration to which you want to change the display settings.