Solved

HOW TO KNOW WHEN THE USER CHANGE THE WALLPAPER

Posted on 2006-07-02
2
230 Views
Last Modified: 2010-04-05
I WOULD LIKE TO KNOW WHEN THE USER CHANGE THE WALLPAPER, AFTER THAT:

SHOW MESSAGE TO HIM THAT SAYS LIKE " YOU CAN NOT CHANGE THE WALL PAPERT"

AND FINALLY, CHANGE TO MY OWN WALLPAPER.
0
Comment
Question by:rafaelrgl
2 Comments
 
LVL 3

Accepted Solution

by:
Ubethatway earned 500 total points
ID: 17028643
To disable the user from being able to change the wallpaper you need to use the registry. See this article for instructions:

http://delphi.about.com/od/windowsshellapi/l/aa081703a.htm

Alternatively, if you dont want to disable that page entirely, you will need to monitor the registry, note when the wallpaoper is changed, display that message, then revert to the old wallpaper.

This article shows you how to change the wallpaper from delphi:

http://delphi.about.com/od/windowsshellapi/a/tregistry.htm

QUOTE:

uses registry;
procedure TForm1.FormCreate(Sender: TObject) ;
var
   reg:TRegistry;
begin
   reg:=TRegistry.Create;
   with reg do begin
    try
     if OpenKey('\Control Panel\desktop', False) then begin
     //change wallpaper and tile it
      reg.WriteString ('Wallpaper','c:\windows\CIRCLES.bmp') ;
      //update changes immediately
      SystemParametersInfo (SPI_SETDESKWALLPAPER,0, nil,SPIF_SENDWININICHANGE) ;
     end
    finally
      reg.Free;
    end;
   end;
end;

Simply replace 'c:\windows\CIRCLES.bmp' with the file you wish to use as wallpaper.

For help on monitoring the registry see this article:

http://delphi.about.com/od/kbwinshell/l/aa052003a.htm

The registry key you will need to monitor is: \Control Panel\desktop\Wallpaper

Hope that helps, Mark
0
 
LVL 17

Expert Comment

by:TheRealLoki
ID: 17028685
private
    { Private declarations }
    procedure WM_SETTINGCHANGE(var Message:TMessage); message WM_SETTINGCHANGE;

procedure TForm1.WM_SETTINGCHANGE(var Message:TMessage);
begin
  if (message.WParam = SPI_SETDESKWALLPAPER)
    or (message.Msg = SPI_SETDESKWALLPAPER)  then //wallpaper changed
end;
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This video discusses moving either the default database or any database to a new volume.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now