Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Screensaver UDF


  • Please log in to reply
50 replies to this topic

#41 Squirrely1

Squirrely1

    Stove pipe won't shut.

  • Active Members
  • PipPipPipPipPipPip
  • 726 posts

Posted 14 August 2008 - 06:21 AM

The screensaver appeared to be working fine before you found a problem, UEZ, and it appears to be a serious problem.

With the help of your MsgBox .png, I was able to replicate the problem and I am working to to fix it.

I will post a new message in this thread once a solution has been found, which will work on my computer, but will not have been tested on Vista.

One part of the solution seemed to be to use __WinGetParent once more in that function, but that hasn't worked so far - I'm looking into the child process method right now.

Here is a .png of what I got after I put in another __WinGetParent call into the __SS_ClosePrevInstance_OpenDLL function in v0.98:

Edited by Squirrely1, 14 August 2008 - 06:22 AM.

Das Häschen benutzt Radar







#42 UEZ

UEZ

    Never say never

  • MVPs
  • 4,973 posts

Posted 14 August 2008 - 07:27 AM

The screensaver appeared to be working fine before you found a problem, UEZ, and it appears to be a serious problem.

With the help of your MsgBox .png, I was able to replicate the problem and I am working to to fix it.

I will post a new message in this thread once a solution has been found, which will work on my computer, but will not have been tested on Vista.

One part of the solution seemed to be to use __WinGetParent once more in that function, but that hasn't worked so far - I'm looking into the child process method right now.

Here is a .png of what I got after I put in another __WinGetParent call into the __SS_ClosePrevInstance_OpenDLL function in v0.98:

With _SS_UDF.au3 the close process is working properly but not the close of ss process when selecting another ss in ComboBox! Mabye there you can find a solution...

That the reason why I asked for a solution with parent / child processes. I didn't find any hint in this forum.

By the way, the problem is not a Vista problem only. I got some situation also on my XP.

So, if we can find out how to control parent process and its child processes then the problems can be solved.



UEZ

 
The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯


#43 Squirrely1

Squirrely1

    Stove pipe won't shut.

  • Active Members
  • PipPipPipPipPipPip
  • 726 posts

Posted 14 August 2008 - 01:10 PM

With _SS_UDF.au3 the close process is working properly but not the close of ss process when selecting another ss in ComboBox!...

Yeah, this is why I got started writing Screensaver.au3

Hey, I found a problem in using _SS_ShallExit_OnTimer - the problem is that if the system closes the $_SS_Gui which is the GUI created in _SS_GUICreate, then all the timers associated with that GUI are killed and _SS_ShallExit_OnTimer is never called that one last time it needs to be called.

But if you aren't using _SS_ShallExit_OnTimer like "Light a Candle" does, but only using _SS_ShouldExit, I have a fix already.

v0.99 will be finished soon, I hope, but here is what I have going so far...

Once you have the actual handle to Display Properties, rather than just its tab control, then this works to get the PID of the correct rundll32.exe process (in __SS_ClosePrevInstance_OpenDLL):
Global $iDP_pid $iDP_pid = WinGetProcess($hAppletWin)


Then in the _SS_ShouldExit function, this should work (for under the "Install" case:)
Case "Install" ;... If Not ProcessExists($iDP_pid) Then Return 1 ;...


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

To get the handle of the actual $hAppletWin, we just use these two lines:
            Local $hParentStatic1 = __WinGetParent($hWinLittlePreview, $hUser32DLL)             $hScrTab = __WinGetParent($hParentStatic1, $hUser32DLL); Screen Saver tab of the applet window.

in place of this line in __SS_ClosePrevInstance_OpenDLL ...
            $hScrTab = __WinGetParent($hWinLittlePreview, $hUser32DLL)


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

By the way, the problem is not a Vista problem only. I got some situation also on my XP.

This kind of information helps a lot.


Edit1: A non-working redo of the function _SS_ShallExit_OnTimer was removed.

Edit2: Just found a solution to the_SS_ShallExit_OnTimer problem - attaching the timers to the hidden AutoIt window. This window does not close, it seems, until the whole script exits!

Edited by Squirrely1, 14 August 2008 - 02:32 PM.

Das Häschen benutzt Radar

#44 Squirrely1

Squirrely1

    Stove pipe won't shut.

  • Active Members
  • PipPipPipPipPipPip
  • 726 posts

Posted 15 August 2008 - 01:16 AM

Okay, UEZ and everyone using this - v0.99 of Screensaver.au3 is finished.

v0.99 just has to work for UEZ, was designed to perhaps work on non-English versions of Windows, attaches a better Configuration dialog properly to the Display Properties applet window, optionally uses the SystemMetrics properly now, and has a better way to use a Timer function to determine when to exit ...

There is also a new version of the moving-text example screensaver, posted there (click on Screensaver.au3 in my signature below).

Edit: Errors found in v0.99 of Screensaver.au3 ...

Error 1: $_SS_Top was not being set correctly when the first parameter is set to True in _SS_GUICreate. To fix this problem, replace the function _SS_GUICreate with this version:

AutoIt         
;=================================================================================================== ; Name:     _SS_GUICreate ; Purpose:  Creates the GUI for your screensaver if the value of $_SS_Mode is "Test or "Install", ;               but not if it is "Configure" ; Params: ;           boolUseSysMetrics - Set this to 1 or True if you want the function to make calls to ;               user32.dll, GetSystemMetrics to get $_SS_Left, $_SS_Top, $_SS_Width, & $_SS_Height. ; Notes: ;           A call to this function is Required. ;           Call this function sometime after you have called _SS_Initialize_RunMode but before you ;               build any controls for the GUI or make your call to _SS_Start. ;           After calling this function, you can make the window hidden or transparent using ;               WinSetTrans($_SS_Gui) or WinSetState. ;           When _SS_Initialize_RunMode was previously called passing 1 for the first parameter, ;               The On-top attribute is not set for the GUI created in this function, and a HotKey ;               "ESC" is set as a means of exiting a hanging screen saver - (for trial runs). ;           This function sets the values of the globals $_SS_Width, $_SS_Height, & $_SS_Gui, for ;               potential use by the screensaver author. ; Requires: ;           When $_SS_Mode = "Test" or "Install" then ... ;               The global $hUser32DLL to contain the value returned by DllOpen("user32.dll") ;               The functions __WinSetParent AND __WinShowCursor to be defined. ; Authors: ;           james3mg; amended by Squirrely1 - July 20, 2008; Kudos UEZ ;=================================================================================================== Func _SS_GUICreate($UseSysMetrics = False)     Local Const $_POPUP = 0x80000000     Local Const $_EX_TOPMOST = 0x00000008     Local Const $_VIRTUAL_WIDTH = 78     Local Const $_VIRTUAL_HEIGHT = 79     Local Const $_VIRTUAL_LEFT = 76     Local Const $_VIRTUAL_TOP = 77     Local $VirtualDtWidth[2], $VirtualDtHeight[2], $VirtualDtLeft[2], $VirtualDtTop[2], $Pos[4], $cSize[2]     $_SS_Width = @DesktopWidth; set the global for use by the author.     $_SS_Height = @DesktopHeight; set the global for use by the author.     $_SS_Left = 0; set the global for use by the author.     $_SS_Top = 0; set the global for use by the author.     Switch $_SS_Mode         Case "Test"             If $UseSysMetrics Then                 $VirtualDtWidth = DllCall($hUser32DLL, "int", "GetSystemMetrics", "int", $_VIRTUAL_WIDTH)                 If Not @error Then $_SS_Width = $VirtualDtWidth[0]                 $VirtualDtHeight = DllCall($hUser32DLL, "int", "GetSystemMetrics", "int", $_VIRTUAL_HEIGHT)                 If Not @error Then $_SS_Height = $VirtualDtHeight[0]                 $VirtualDtLeft = DllCall($hUser32DLL, "int", "GetSystemMetrics", "int", $_VIRTUAL_LEFT)                 If Not @error Then $_SS_Left = $VirtualDtLeft[0]                 $VirtualDtTop = DllCall($hUser32DLL, "int", "GetSystemMetrics", "int", $_VIRTUAL_TOP)                 If Not @error Then $_SS_Top = $VirtualDtTop[0]             EndIf             $_SS_Gui = GUICreate($_OUR_GUI_TITLE, $_SS_Width, $_SS_Height, $_SS_Left, $_SS_Top, $_POPUP, $_EX_TOPMOST)             __WinShowCursor(False, $hUser32DLL); hides cursor over even the Shockwave object. ;               GUISetCursor(16, 1, $_SS_Gui); won't hide cursor over the Shockwave object.         Case "Install"             $Pos = WinGetPos($hWinLittlePreview); Handle of the little preview window.             $_SS_Width = $Pos[2];152 - width of the little preview window.             $_SS_Height = $Pos[3];112 - height of the little preview window.             $_SS_Gui = GUICreate($_OUR_GUI_TITLE, $_SS_Width, $_SS_Height, $_SS_Left, $_SS_Top, $_POPUP)             __WinSetParent($_SS_Gui, HWnd($hWinLittlePreview), $hUser32DLL)         Case "Configure"             $_ConfigWin_Left = (@DesktopWidth / 2) - ($_ConfigWin_Width / 2)             $_ConfigWin_Top = (@DesktopHeight / 2) - ($_ConfigWin_Height / 2)             If IsHWnd($hAppletWin) Then                 $Pos = WinGetPos($hAppletWin)                 If Not @error Then                     $_ConfigWin_Left = $Pos[0] + 5                     $_ConfigWin_Top = $Pos[1]                 Else                 EndIf                 $cSize = WinGetClientSize($hAppletWin)                 If Not @error Then                     $_ConfigWin_Top += Abs(($Pos[3] - $cSize[1]))                 Else                     $_ConfigWin_Top += 30                 EndIf             EndIf             ; This gui is created only in the function whose name is stored in $_ConfigLoop_Function.     EndSwitch EndFunc


Error 2: I found a few troublesome documentation errors in a few of the functions.

Edited by Squirrely1, 15 August 2008 - 03:53 AM.

Das Häschen benutzt Radar

#45 UEZ

UEZ

    Never say never

  • MVPs
  • 4,973 posts

Posted 15 August 2008 - 07:54 AM

Well done Squirrely1! Level completed :D

Screensaver closes properly now!


Did you find how to get parent process PID and the amount of its child processes? Currently I'm at Boot Camp for exam preparation (70-640). :P

Next week I will have more time to do more on programming... :P


Thanks for you work.


UEZ :o

 
The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯


#46 UEZ

UEZ

    Never say never

  • MVPs
  • 4,973 posts

Posted 16 August 2008 - 10:02 AM

That might be possible UEZ, and I will investigate that possibility, but it will probably be a few days before I have come up with anything along those lines. There probably is a function to find out whether a process is a child of another using AutoIt, but I have not seen it in the AutoIt help file. I would begin the search here in the forums.

There is a standard udf that comes with the latest versions of AutoIt to get the parent window of a window.

Edit: Function replacement removed.

Thanks for identifying this problem, UEZ; I think I know of a fix and it should show up in v0.99 - the next version.



Look here for a solution: http://www.autoitscript.com/forum/index.php?showtopic=78445 (thanks to SmOke_N!)


Here my screensaver (Magic Lines Screensaver) incl. source code - it still needs a lot of work (my 1st steps in GDI+)!

UEZ

PS: different behaviour on AMD CPUs - on Intel CPU's it is working properly (division by zero)!

Edited by UEZ, 24 August 2009 - 05:41 PM.

 
The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯


#47 Squirrely1

Squirrely1

    Stove pipe won't shut.

  • Active Members
  • PipPipPipPipPipPip
  • 726 posts

Posted 16 August 2008 - 03:51 PM

Well I found a few problems in my versions of the Timer functions I have in Screensaver.au3 v0.99

Here are some fresh versions, documented better, and which include the standard udf _WinAPI_IsWindow in nearly much unadulterated form ...

This does not work with Screensaver.au3 yet, but I might use it there - simple to use and reliable if not overused ...
Latest - Doesn't use window handles:

This shoud work in Screensaver.au3 v0.99.5 ...
Survived - without harness - good as udf's -

Survived rigorous tests - w/ harness -

Complete with a test harness - (Somewhat Broken):

;)

Edit: Thanks again for your help, UEZ.

v0.99.5 is out now.

Edited by Squirrely1, 19 August 2008 - 01:54 AM.

Das Häschen benutzt Radar

#48 UEZ

UEZ

    Never say never

  • MVPs
  • 4,973 posts

Posted 17 August 2008 - 02:43 PM

...

Edit: Thanks again for your help, UEZ.

v0.99.5 is out now.


You're welcome ;)

UEZ

 
The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯


#49 TurionAltec

TurionAltec

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 405 posts

Posted 05 January 2010 - 04:13 AM

Exactly what I needed. All I was looking to make was an all white screensaver that works on all monitors. Just took a couple lines of code.

#50 james3mg

james3mg

    I resent the title "Spammer!" ;-)

  • Active Members
  • PipPipPipPipPipPip
  • 730 posts

Posted 08 January 2010 - 06:36 PM

holy...I hadn't noticed everything that's happened in here since summer '08! Sometimes I wish e-mail subscriptions on your own topics didn't expire.

Anyway, nice work to Squirrely on continuing what I'd started. If I ever need to make a new screensaver, I'll have to check it out, lol!
Posted ImagePosted Image"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110

#51 Qwerty212

Qwerty212

    Adventurer

  • Active Members
  • PipPip
  • 106 posts

Posted 26 May 2012 - 05:26 AM

Thanks for the udf, it has been very useful to me.

But... is there anyway to react to the end of the screensaver?

I mean, perform an action when the screensaver must be closed due to a mose movement or a keyboard stroke.

Greets from Catalonia.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users