Friday, January 21, 2011

Disabling screen saver temporarily

If you want to turn off the screen saver while your program is running, you don't have to disable the Windows screen saver at all. Just define the following method to handle the appropriate Windows message:

procedure TForm1.AppMessage (var Msg: TMsg; var Handled: boolean);
begin
  if (Msg.Message = WM_SYSCOMMAND) and (Msg.wParam = SC_SCREENSAVE) then
    Handled := true;
end;
On the form's OnCreate event, assign 
Application.OnMessage := AppMessage;

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Kang Iwan K-sev | Thank's for your visit To My Site - Ridwan Mulyana | Cibeureum