Screen saver still activates with Msg.Result:=0
Screen saver still activates with Msg.Result:=0
What are you using to test if this code works? Using ScreenSaver Preview will not generate a SC_SCREENSAVE message, but if you set your screen saver timeout to 1 minute and wait, it will and you will see that the screensaver does not kick in. I know because I just tried it.Originally Posted by nzo2
It isn`t using a screensaver preview. I let the screensaver kick in. The SC_SCREENSAVE message is generated and is intercepted. However, the screensaver still runs.
Here we are. Just tried this and the screensaver kicked in as normal...
The form is "default" as in File => New Project
[pascal]
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TForm1 = class(TForm)
private
{ Private declarations }
procedure WMSysCommand(var Msg : TWMSysCommand); message WM_SYSCOMMAND;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
procedure TForm1.WMSysCommand(var Msg : TWMSysCommand);
begin
if (Msg.CmdType = SC_MONITORPOWER) or (Msg.CmdType = SC_SCREENSAVE) then
begin
Msg.Result:=0;
end
else
inherited;
end;
{$R *.DFM}
end.
[/pascal]
That is, line for line, exactly the code I used and it works fine for me.
Is the Screen Saver a default Windows one? I know I'm grasping at straws here, but it's the only thing I can think of.
yes, just the XP logo. Only thing different is it is password enabled.
where you set the timeout, checkbox for onresume, password protected
Hmm I don't have a password option, though I have seen it on other systems. If you remove your password protection, does it still start the screen saver?
Bookmarks