I have use of the UDF's except for the last function - _SS_ShouldExit - instead, I like this method ...
Interesting- I hadn't seen that method before. I'll look into it and see if I can incorporate it into my UDF so that it's cleaner than my current method...then I'll repost my UDF.
Thanks
"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
I've uploaded a new version of the UDF, using this new method for determining idle status. Thanks to erifash for finding this method and squirrely1 for pointing it out.
There is a change you need to be aware of in this new version. I've left the $_SS_Sensitivity=10 parameter in _SS_ShouldExit(), but it's not used in this version. Changing the number will not have any effect any more. I've left it in to maintain backward compatibility, and because I hope to eventually let it be functional again. That means that if the mouse moves even just a little (say, even one pixel), the screensaver will exit (if this function is used). Previously, by default, the mouse would have to move 10 pixels to register (that made it less likely for the screensaver to prematurely terminate because a door slammed in your house and your desk shook a little, for instance ). The tradeoff of this behavior is, I think, worth it.
Now ANY key will terminate the screensaver (rather than just character typing keys, as before). So printscreen, caps lock, shift, etc will all terminate the screensaver. However, the screensaver will not grab the action of these keys- pressing caps lock will terminate the screensaver, but still actually toggle the caps lock state. Character typing keys and keys that are used in a software manner (F- keys, etc) will NOT be passed through to the window behind the screensaver. As always, Windows-registered hotkeys will still call their programs/functions after the screensaver terminates.
I'll do some research on this new method for the next version- I hope to allow the user to choose some keys (printscreen or arrow keys would probably be common ones) to NOT terminate the screensaver. But I don't know if it's possible.
As always, I'll post any updates here.
Thanks for your comments!
Edit: realized how I could reimplement the sensitivity paramenter-OP is updated. Now the new version is, in all ways, as good as the old method, with no downside.
Edited by james3mg, 29 April 2008 - 07:44 PM.
"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
I wrote a version of this great include file that james3mg began and named my copy Screensaver.au3.
My version fixes a few remaining issues, and worked perfectly on my system. But I don't have multiple monitors, I only have one computer that has XP SP3 on it, and so I can't test this on Windows 98 or Windows Vista, etcetera.
The attached include file is documented thoroughly. Feedback would be very helpful:
Latest: v1.0 - Fixes, better doc's -
Old: v0.99.5 - Fixes, better doc's - v0.99 - New features & fixes - v0.98 - Perhaps Broken - v0.97 - New Features - v0.96 - Fixed --- v0.95 - Broken - v0.90 - Original-
Moving-text example, revised once AGAIN to work with v0.99.5 of Screensaver.au3, using the Timer functions:
I realy like your _SS_UDF but can you explain me how to implement a password-routine?
Best regards, Aakira
I guess you are talking about the "/a" or "-a" command-lin switch - well it is only for Windows 98 and Windows ME as far as I know, and I can't explore the use of that parameter because I only have one machine with XP and the other one uses MSDOS 6.2 for an OS. But all that switch is supposed to do is to open a dialog wherein you change a password and password protect your screensaver that way, instead, I guess, of doing it the way we do in XP, by just leaving checked the little checkbox there in the Screen Saver tab of the Display Properties applet you find under the Control Panel.
I am sure that one of the coders here has Windows 98 going, and it might just be a matter of time before someone finds the includes file and adds that last bit of functionality to it.
I guess you are talking about the "/a" or "-a" command-lin switch - well it is only for Windows 98 and Windows ME as far as I know, and I can't explore the use of that parameter because I only have one machine with XP and the other one uses MSDOS 6.2 for an OS. But all that switch is supposed to do is to open a dialog wherein you change a password and password protect your screensaver that way, instead, I guess, of doing it the way we do in XP, by just leaving checked the little checkbox there in the Screen Saver tab of the Display Properties applet you find under the Control Panel.
I am sure that one of the coders here has Windows 98 going, and it might just be a matter of time before someone finds the includes file and adds that last bit of functionality to it.
Do you use Windows 98 or ME ?
No, I am using W2k. But I don't want to use the normal Windows-Password. I want to use an other password.
Well I am not an expert at writing screensavers, but this seems like a great idea and I have thought about it.
You would have a function that creates a GUI and you use GUICtrlCreateInput using the password flag, and I guess you try to hide the password in the registry somewhere. I have come across threads in this forum that describe a good way to hide that password in the registry and so forth.
Since somone wanted this functionality, I will make a note to myself to create a function for it sometime - but it probably won't happen soon.
I compiled Squirrely1's screensaver v0.97 and found out that the close function for preview is not working properly:
If I open the screensaver settings window where I can select any of available screensaver, I can see the preview of it.
But if I'm going to select another one then normally the called process from rundll32.exe should close the old screensaver (Squirrely1's screensaver) process
and should start the new one.
But this is not done - after selecting another one, 2 screensaver tasks are running at the same time. When closing the screensaver settings window then all processes
will close.
Can somebody confirm?
Thanks,
UEZ
The own fart smells best!✌ Her 'sikim hıyar' diyene bir avuç tuz alıp koşma! ¯\_(ツ)_/¯
I compiled Squirrely1's screensaver v0.97 and found out that the close function for preview is not working properly...
Using v0.98 of the includes file, the process ends as required when changing selections in the dropdown box. I couldn't replicate the error you describe on my Windows XP, UEZ.
Will you make the latest version (v0.98) of the includes file work on your version of Windows, tell me what code you changed, and also - describe the platform(s) you have checked the file on and for which it is now working properly?
Here is a .zip file containing the code and other files required to build the compiled screensaver linked at the bottom of my signature - for use only with the v0.98 of Screensaver.au3, also linked in my sig ...
Using v0.98 of the includes file, the process ends as required when changing selections in the dropdown box. I couldn't replicate the error you describe on my Windows XP, UEZ.
Will you make the latest version (v0.98) of the includes file work on your version of Windows, tell me what code you changed, and also - describe the platform(s) you have checked the file on and for which it is now working properly?
Yes, that's right but I compiled your screensaver v0.97 with _SS_UDF.au3 made by james3mg. I'am using Vista SP1 and latest AutoIt (not beta).
By the way, udf screensaver.au3 doesn't close the screensaver preview process properly when closing screensaver settings window. It just close the rundll32.exe and makes the child screensaver process to parent! But the closing of screensaver task when selecting a different one from the pull down list, is working!
UEZ
The own fart smells best!✌ Her 'sikim hıyar' diyene bir avuç tuz alıp koşma! ¯\_(ツ)_/¯
UEZ - using the new and improved v0.98 of Screensaver.au3, your screensaver will now close when you click on a new tab - such as Desktop or Appearance, whereas in v0.97 it would not close.
If you discover that it does not work this way in Vista, let me know - I want it to work properly under Vista.
UEZ - using the new and improved v0.98 of Screensaver.au3, your screensaver will now close when you click on a new tab - such as Desktop or Appearance, whereas in v0.97 it would not close.
If you discover that it does not work this way in Vista, let me know - I want it to work properly under Vista.
Squirrely1,
same situation on WinXP:
I compiled Light a Candle.au3 with latest AutoIt version, screensaver.au3 v0.98 (UDF) and moved Light a Candle.scr to %windir%\system32.
When I open screensaver settings tab and select your ss 'Light a Candle' then it will be started by rundll32.exe as parent process and your ss 'Light a Candle.scr' becomes a child process -> see screenshot Process1.png
If I switch to another tab then the ss process will be closed properly by parent process (rundll32.exe) which is still active.
But when I selected your ss and press ok then parent process (rundll32.exe) will be closed and your ss process become parent process -> see screenshot Process2.png. Normally it should be closed, too.
So, I assume that the close process is not working properly.
Replace the following function in v0.98 of Screensaver.au3 with this ...
AutoIt
Func__SS_ClosePrevInstance_OpenDLL()Local$tPos[4]IfWinExists($_WIN_TITLE)ThenWinKill($_WIN_TITLE)AutoItWinSetTitle($_WIN_TITLE)Switch$_SS_ModeCase"Test"$hUser32DLL=DllOpen("user32.dll"); needed for _SS_ShouldExit, etcetera.Sleep(230)Case"Configure"$_AppletTab_Left=(@DesktopWidth/2)-(516/2)$_AppletTab_Top=(@DesktopHeight/2)-(236/2)If$CmdLine[0]AndStringMid($CmdLine[1],2,2)="c:"Then$hScrTab=HWnd(StringMid($CmdLine[1],4)); get the handle of the Screen Saver tabIfIsHWnd($hScrTab)Then$tPos=WinGetPos(HWnd($hScrTab))$_AppletTab_Left=$tPos[0]+20$_AppletTab_Top=$tPos[1]+20EndIfEndIfCase"Install"$hUser32DLL=DllOpen("user32.dll")Sleep(230)$hWinLittlePreview=HWnd($CmdLine[2])$hScrTab=__WinGetParent($hWinLittlePreview,$hUser32DLL); Screen Saver tab of the applet window.; Needed for _SS_ShouldExit or _SS_ShallExit_OnTimer ...$hAppletWin=__WinGetParent($hScrTab,$hUser32DLL); Control Panel applet window handle.$hAppletCombo1=ControlGetHandle($hAppletWin,"","[ID:1300]"); Applet's Dropdown handle.$initSel=__ComboGetCurSel($hAppletCombo1); Index of the item currently selected in Dropdown.MsgBox($_MSG_BOX_STYLES,"",_"String($hUser32DLL):"&String($hUser32DLL)&" - should NOT be -1"_&@CR&"IsHWnd($hWinLittlePreview):"&IsHWnd($hWinLittlePreview)&" - should be 1"_&@CR&"IsHWnd($hScrTab):"&IsHWnd($hScrTab)&" - should be 1"_&@CR&"WinGetTitle($hScrTab):"&WinGetTitle($hScrTab)&" - should be: [Unknown]."_&@CR&"IsHWnd($hAppletWin):"&IsHWnd($hAppletWin)&" - should be 1"_&@CR&"WinGetTitle($hAppletWin):"&WinGetTitle($hAppletWin)&" - should be Display Properties"_&@CR&"IsHWnd($hAppletCombo1):"&IsHWnd($hAppletCombo1)&" - should be 1"_&@CR&"$initSel:"&$initSel&" - should NOT be 0"_)EndSwitchEndFunc
You would have to compile, but if you would, please post a .png screenshot of the MsgBox, into this thread.
If the screensaver closes properly when you select a different screensaver from the ComboBox, that means our code is working correctly to get the handle of the ComboBox, which it could not do without also correctly finding the handle to $hAppletWin, as far as I know, and so the following line in the function _SS_ShouldExit is supposed to close the screensaver:
Is it possible to get the parent process PID from ss? And then how many child processes the parent process has openend?
E.g. let take the screenshots from my previous post:
RunDLL32.exe with PID 2156
Light a Candle.scr PID 2540
Is it possible now to get the PID of rundll32.exe within screensaver? Afterwards the amount of child processes of rundll32.exe?
Why? Because if another child process will be opened by rundll32.exe, e.g. when selecting another ss in settings window, then the current ss can be closed.
If child processes > 1 then close screensaver
Your are using ComboBox to know whether another ss has been selected.
Thanks,
UEZ
The own fart smells best!✌ Her 'sikim hıyar' diyene bir avuç tuz alıp koşma! ¯\_(ツ)_/¯
Is it possible to get the parent process PID from ss? And then how many child processes the parent process has openend?
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.
Replace the following function in v0.98 of Screensaver.au3 with this ...
...
You would have to compile, but if you would, please post a .png screenshot of the MsgBox, into this thread.
If the screensaver closes properly when you select a different screensaver from the ComboBox, that means our code is working correctly to get the handle of the ComboBox, which it could not do without also correctly finding the handle to $hAppletWin, as far as I know, and so the following line in the function _SS_ShouldExit is supposed to close the screensaver:
If Not WinExists(HWnd($hAppletWin)) Then Return 1
Here the screenshot from Vista.
Yes, it closes properly when selecting a different ss but not when you select ss compiled with screensaver.au3 and press ok. It becomes parent process running as described above.
UEZ
PS: screenshot deleted because of attachment space is nearly full :-(
Edited by UEZ, 15 April 2010 - 09:23 AM.
The own fart smells best!✌ Her 'sikim hıyar' diyene bir avuç tuz alıp koşma! ¯\_(ツ)_/¯