AnsweredAssumed Answered

vrf Initiating a screen saver

Question asked by VRFuser on Jul 27, 2005
Hi Paul and Shaun,

Many thanks for the API examples...  Sadly Paul's suggestion of repeating the SendMessageA() call does not do anything for me (the screen saver stays activated).  For what it's worth I am running Win2k SP4.

Any ideas in .net?  (Maybe I can persuade the end user to upgrade to VEE 7-5)

Thanks

Andy



-----Original Message-----
From: Paul.Fowler@raytheon.co.uk [mailto:Paul.Fowler@raytheon.co.uk]
Sent: 27 July 2005 09:40
To: VRF
Cc: VRF
Subject: RE: [vrf] Initiating a screen saver



>> how to start the screensaver
>> via a Win32 API call from VEE.

> PostMessage(hWnd, WM_SYSCOMMAND, SC_SCREENSAVE, 0);
                     (0x112)        (0xf140)
> to (almost) any window. The VEE window works fine.

Shawn,

I'm using User32.SendMessageA with the same parameters.

For me; repeating this command stops the screensaver.

A quick googling tells me I should use 1 or  -1 as the last parameter, but it works fine with the zero.

Paul F.





"Shawn Fessenden" <shawn@testech-ltd.com> Document Marked as Unclassified

                    "Shawn Fessenden" <shawn@testech-ltd.com>
                    27/07/2005 01:13
                                                         Please respond to "Shawn Fessenden"
                     
                                        Stationery name:-Untitled-

       
        To:        VRF <vrf@agilent.com>
        cc:        
        Subject:        RE: [vrf] Initiating a screen saver


> how to start the screensaver
> via a Win32 API call from VEE.

PostMessage(hWnd, WM_SYSCOMMAND, SC_SCREENSAVE, 0);
                    (0x112)        (0xf140)
to (almost) any window. The VEE window works fine. Stopping it is another
matter. The recommended method is to use SystemParametersInfo with an action
of SPI_SETSCREENSAVETIMEOUT to set a large timeout. However, I found that
this method won't work. I also tried using SystemParametersInfo to disable
it, stop it, etc. Tried posting click messages, button clicks, send keys...
couldn't get it to shut off. Don't know what to do about that. Maybe
simulating a mouse move would work (see SendInput).

int __stdcall SystemParametersInfoA(int uiAction, int uiParam, int *piParam,
int fWinIni);

uiAction:
SPI_GETSCREENSAVETIMEOUT  0x000e  piParam: timeout in sec.
SPI_SETSCREENSAVETIMEOUT  0x000f  uiParam: timeout in sec.
SPI_GETSCREENSAVEACTIVE   0x0010  piParam: 0 = disabled, ~0 = enabled.
SPI_SETSCREENSAVEACTIVE   0x0011  uiParam: 0 = disabled, ~0 = enabled.

The attached (VEE 7) program posts WM_SYSCOMMAND, SC_SCREENSAVE to start the
screen saver. Er, make sure you have a screen saver enabled!

In the attached program, SystemParametersInfo is defined without an int
pointer to avoid using a call box. This means you can't use SPI_GETxxx and
you must always pass 0 for the third parameter.

NOTE: The common wisdom of years past on how to *prevent* the screen saver
from starting was to subclass a window and eat WM_SYSCOMMAND, SC_SCREENSAVE.
Unfortunately I can't remember the common wisdom on how to get it to stop
once it's started. I will try to look it up.
-SHAWN-

---
You are currently subscribed to vrf as: Paul.Fowler@raytheon.co.uk
To subscribe send a blank email to "join-vrf@it.lists.it.agilent.com".
To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".
To send messages to this mailing list,  email "vrf@agilent.com". 
If you need help with the mailing list send a message to "owner-vrf@it.lists.it.agilent.com".

--- You are currently subscribed to vrf as: andy_street@agilent.com To subscribe send a blank email to "join-vrf@it.lists.it.agilent.com". To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com". To send messages to this mailing list, email "vrf@agilent.com". If you need help with the mailing list send a message to "owner-vrf@it.lists.it.agilent.com".

---
You are currently subscribed to vrf as: rsb@soco.agilent.com
To subscribe send a blank email to "join-vrf@it.lists.it.agilent.com".
To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".
To send messages to this mailing list,  email "vrf@agilent.com". 
If you need help with the mailing list send a message to "owner-vrf@it.lists.it.agilent.com".

Outcomes