Article View: borland.public.cppbuilder.nativeapi
Article #15918Re: Stopping the Windows Screen Saver...
From: Roman Nádhera
Date: Sat, 07 Jun 2003 14:43
Date: Sat, 07 Jun 2003 14:43
50 lines
2058 bytes
2058 bytes
Hello, what about to do it like this way
----------------------------------------
BEGIN_MESSAGE_MAP
MESSAGE_HANDLER(WM_SYSCOMMAND,TMessage,SysCommand)
END_MESSAGE_MAP(TForm)
...........
...........
void __fastcall TForm1::SysCommand(TMessage& Msg)
{
int ii;
ii = Msg.WParam & 0xFFF0;
if (ii==SC_SCREENSAVE)
{
screensaved = 1;
}
TForm::Dispatch(&Msg);
}
..............
..............
..............
..............
// some event shuts down the screensaver
if (screensaved)
{
hwnd_sc = FindWindow("WindowsScreenSaverClass",NULL);
if (hwnd_sc==NULL) hwnd_sc = HWND_BROADCAST;
SendMessage (hwnd_sc,WM_KEYDOWN,0,0);
screensaved = 0;
}
SendMessage (Handle,WM_ACTIVATE,WA_ACTIVE,0);
..............
..............
..............
..............
..............
// You can also activate screensaver (for example by button click)
.... Button1Click (*Sender)
{
SendMessage (HWND_BROADCAST,WM_SYSCOMMAND,SC_SCREENSAVE,0);
}
Technical Details
Message-ID:
<3EE1F9FE.6060006@wo.cz>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-mailReferences:
<3ed3d8a9@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,51aedba360c457e2 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-06-07 07:46:18 PST Message-ID: <3EE1F9FE.6060006@wo.cz> Date: Sat, 07 Jun 2003 16:43:10 +0200 From: Roman Nádhera <nadhera@wo.cz> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20030208 Netscape/7.02 X-Accept-Language: cs, en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Stopping the Windows Screen Saver... References: <3ed3d8a9@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 160.218.176.57 X-Trace: newsgroups.borland.com 1054996995 160.218.176.57 (7 Jun 2003 07:43:15 -0700) Lines: 59 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