• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 243
  • Last Modified:

How can I know that the screen has changed?

Is there any event or message that can tell me that some portion of the screen has changed? where? and the color value it has taken?
0
guitfatio
Asked:
guitfatio
  • 5
  • 2
  • 2
  • +2
2 Solutions
 
sundayboysCommented:
listening
0
 
sundayboysCommented:
http:Q_20176086.html
this maybe can help you .
0
 
MarcGCommented:
the Message WM_DisplayChange is fired after chges of the resolution or color depth
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
MarcGCommented:
the Message WM_DisplayChange is fired after chges of the resolution or color depth
0
 
MarcGCommented:
here's an example, just a form containing a TMemo

type
  TForm1 = class(TForm)
    Memo1: TMemo;
  private
  public
    procedure WMDispChange(var message : TWMDisplayChange) ; message WM_DisplayChange;
  end;

and the procedure ...

procedure  TForm1.WMDispChange(var message : TWMDisplayChange) ;
begin
  memo1.Lines.Add('Newcolor depth : '+ IntToStr(message.BitsPerPixel));
  memo1.lines.Add('New horiz resolution : ' + IntToStr(message.Width));
  memo1.lines.Add('New vert resolution : ' + IntToStr(message.Height));
end;
0
 
MadshiCommented:
Hooking WM_PAINT may not be enough. A lot of programs/windows/components paint on the screen without using WM_PAINT at all. If you want to have a reliable method of getting notified about screen changes, you need to install a GDI hook. That is *very* hard. I would say: Better forget about that...  :-(  Maybe the WM_PAINT approach is the way to go for you, because it's much easier than hooking GDI, unfortunately, as I said, it's not a complete solution...

Regards, Madshi.
0
 
guitfatioAuthor Commented:
How can I install a GDI hook?
0
 
MadshiCommented:
Look here, but it is *very* difficult:

http://www.experts-exchange.com/jsp/qShow.jsp?qid=10938141
0
 
MarcGCommented:
I'm sorry, but I'm not using WM_PAINT message ... or am I ? As far as I understand it I'm not ...

Here's what WinAPI Help says about changing screen resolution ...
"When the display mode is changed dynamically, the WM_DISPLAYCHANGE message is sent to all running applications with the following message parameters:..."
(Help for ChangeDisplaySettings)
0
 
guitfatioAuthor Commented:
This question is not related about changing screen resolution... It's about knowing when and where the screen has changed.
0
 
MarcGCommented:
what ? oops, ssems I misunderstood it, I thought you where talking about the color deppth and chinging it ...
sorry if not ...
0
 
geobulCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

split points between sundayboys and Madshi

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Thanks,

geobul
EE Cleanup Volunteer
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now