Sign in to follow this  
Followers 0
Buffo

Start actual screensaver

5 posts in this topic

Hi,

with the search I found a lot of topics about screensavers, but not that info I need.

Is it possible to start the screensaver that is actual selected?

Here is an example API-Call form VB. Perhaps someone can convert it into Autoit-DLLCall?

Private Declare Function SendMessage Lib "user32" Alias _
  "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, _
  ByVal wParam As Long, ByVal lParam As Long) As Long

Private Const WM_SYSCOMMAND = &H112&
Private Const SC_SCREENSAVE = &HF140&

Public Sub StartScreenSaver(ByVal hWnd As Long)
  Dim Result As Long
  Result = SendMessage(hWnd, WM_SYSCOMMAND, SC_SCREENSAVE, 0&)
End Sub

Thx in advance :whistle:

Regards,

Buffo

Share this post


Link to post
Share on other sites



This seems to work :

$screensaver = RegRead("HKEY_CURRENT_USER\Control Panel\Desktop", "SCRNSAVE.EXE")
If FileExists($screensaver) Then Run($screensaver & " /s")

Share this post


Link to post
Share on other sites

Yes, it works under WinXPSP2 :whistle:

Great and simple idea.

Sometimes it's so easy but my fault is that I think always much to complicated :)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

$screensaver = RegRead("HKEY_CURRENT_USER\Control Panel\Desktop", "SCRNSAVE.EXE")

If FileExists($screensaver) Then Run($screensaver & " /s")

-----------------------------------------------------------------------------

The code works great, but how can i add a 10 second delay to it?

Edit:

Yes I have read the help file, but i still can't figure it out.

Edited by SailorSonic

Share this post


Link to post
Share on other sites

if you read the helpfile and take a look at sleep it would help alot

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0