Solved

Messages

Posted on 2000-04-15
4
292 Views
Last Modified: 2010-04-04
I have two questions about message

When the default home page changed in IE, which message will be sent? And I how to get it?

When the wallpaper changed, which message willb be sent? And I how to get it?

0
Comment
Question by:cookey
  • 2
4 Comments
 
LVL 15

Expert Comment

by:simonet
Comment Utility
No messages are sent for either of the events you asked.

There is, however, a way to monitor changes in both wallpaper and the IE default hp: Monitor the activity in the Registry and, if the changes are made to the keys where that information reside, you know the user (or another program) has changed the wallpaper or the default HP.

Yours,

Alex
0
 
LVL 3

Accepted Solution

by:
f15iaf earned 20 total points
Comment Utility
you can get a message then wallpaper changes

the messge is
WM_SETTINGCHANGE          
 
  wParam = SPI_SETDESKWALLPAPER  
  lParam = pointer to new bitmap file.

you can get this message using this

Trapping messages
 
 Topic groups
 
 Under some circumstances, you might want your components to ignore messages. That is, you want to keep the component  from dispatching the message to its handler. To trap a message, you override the virtual method  WndProc .
  The  WndProc  method screens messages before passing them to the  Dispatch  method, which in turn determines which method  gets to handle the message. By overriding  WndProc , your component gets a chance to filter out messages before dispatching  them. An override of  WndProc  for a control derived from  TWinControl  looks like this:
 
 procedure  TMyControl.WndProc( var  Message: TMessage);
 
 begin
    { tests to determine whether to continue processing }
     inherited  WndProc(Message);
  end ;
 
 The  TControl  component defines entire ranges of mouse messages that it filters when a user is dragging and dropping controls.  Overriding  WndProc  helps this in two ways:  
 
         It can filter ranges of messages instead of having to specify handlers for each one.
          It can preclude dispatching the message at all, so the handlers are never called.
 
example:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;

type
  TForm1 = class(TForm)

  private
    { Private declarations }
  public
    procedure wndproc(var mes:Tmessage);override;
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure Tform1.wndproc(var mes:Tmessage);
begin
        if(mes.msg=WM_SETTINGCHANGE)and(mes.wparam=SPI_SETDESKWALLPAPER)then
        begin

        end;
end;

end.
 
   

0
 

Author Comment

by:cookey
Comment Utility
There are my codes:

type
  TForm1 = class(TForm)
   .....
  private
    procedure SettingCh(var Mes: TWMSETTINGCHANGE); message WM_SETTINGCHANGE;
......

procedure TForm1.SettingCh(var Mes: TWMSETTINGCHANGE);
begin
  inherited;
  Showmessage(IntToStr(Mes.Flag));
end;

but, nothing happend when the wall paper has been changed, no any message has been shown. where is the mistake?

0
 

Author Comment

by:cookey
Comment Utility
There are my codes:

type
  TForm1 = class(TForm)
   .....
  private
    procedure SettingCh(var Mes: TWMSETTINGCHANGE); message WM_SETTINGCHANGE;
......

procedure TForm1.SettingCh(var Mes: TWMSETTINGCHANGE);
begin
  inherited;
  Showmessage(IntToStr(Mes.Flag));
end;

but, nothing happend when the wall paper has been changed, no any message has been shown. where is the mistake?

0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

763 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

12 Experts available now in Live!

Get 1:1 Help Now