🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #15944

It's a mistery??? WM_SYSCOMMAND & Screen Savers

#15944
From: Mike Collins
Date: Wed, 04 Jun 2003 23:13
52 lines
2930 bytes
Hi all, sorry to post again about this but it is a TOTAL MISTERY to me.

I posted a few days ago regarding intercepting the WM_SYSCOMMAND in order to
stop the Windows Screen Saver kicking in.  I had defined a message
processing function, thus:

void __fastcall TMainForm::ProcessMessage(tagMSG &msg, bool &Handled)
{
   // Message Processing / Handling switch.
   switch (msg.message)
   {
      case WM_SYSCOMMAND         :  if (msg.wParam == SC_SCREENSAVE)
                                    {
                                       Handled = true;
                                       //handled =
Config->getGlobalConBit(DISABLE_WIN_SCREEN_SAVER);
                                    }
                                    break;
      default                    :  Handled = false;
                                    break;
   }
}

- now, lone behold, when I run the application, in or out of the IDE, the
B*%$T^�D screen saver still kicks in.  Remy said that there shouldn't be any
problems with the code so I set of hunting, throught all 14 lines to see
what the problems is.  Couldn;t find anything so I created a new application
and this time I dropped on a TApplicationEvents vcl, coded the OnMessage
event thus:

void __fastcall TForm1::ApplicationEvents1Message(tagMSG &Msg,
      bool &Handled)
{
   if ((Msg.message == WM_SYSCOMMAND)&&(Msg.wParam == SC_SCREENSAVE))
   {
      Handled = true;
   }
}

- and guess what - the screen saver still kicks in.  In both cases the
messages are being recieved and processed (and I assume handled) because
I've inserted code to change the main forms caption just after the handled =
true point and it changes.

I almost feel embrased posted because it is such a simple thing and I can't
for the life of me workout why it's not working.  It worked fine the last
time I coded it (another PC and Builder 5).  Any suggestions would be great.
This is really doing my head in.

Living in hope :-)

Mike C
Technical Details
Message-ID: <3ede7c1b@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10cc67,e18e111f10ac0959,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-06-04 16:13:16 PST
Reply-To: "Mike Collins" <mikec@kr8.co.uk>
From: "Mike Collins" <mikec@kr8.co.uk>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: It's a mistery??? WM_SYSCOMMAND & Screen Savers
Date: Thu, 5 Jun 2003 00:13:50 +0100
Lines: 54
Organization: kr8
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 81.2.78.34
Message-ID: <3ede7c1b@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1054768155 81.2.78.34 (4 Jun 2003 16:09:15 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail