HydrogenAudio

Hosted Forums => foobar2000 => 3rd Party Plugins - (fb2k) => Topic started by: Kreisquadratur on 2004-02-04 02:37:44

Title: foo_lock 0.1
Post by: Kreisquadratur on 2004-02-04 02:37:44
Pauses Foobar2000 on workstation lock.
Resumes Foobar2000 on workstation unlock.

- Only when foobar is playing. Stopped and paused will be ignored
- Only support for OSs Win2k+

- Adds a Menuitem under Components for enabling / disabling

Download: foo_lock Plugin (http://pelit.koillismaa.fi/plugins/general.php#51)
Title: foo_lock 0.1
Post by: Jezz_X on 2004-02-05 11:41:51
cool idea
Title: foo_lock 0.1
Post by: saratoga on 2004-02-06 22:09:29
I think i love you.
Title: foo_lock 0.1
Post by: Smiff on 2004-02-06 23:23:53
hmm could/should this work when going to the winxp welcome screen? all my systems are multi-user. i tested it and doesn't seem to work. nice idea for plugin

edit: guess what? it works after you find the menu entry and turn it on! lol *sorry*, posting while tired again. thanks for this simple but essential plugin. /me goes to turn it on for everyone.
Title: foo_lock 0.1
Post by: Kreisquadratur on 2004-02-07 13:47:18
Many thanks for everyone who even realized its existens.
I must that plugin when moving from winamp to the next generation.

I think this plugin is most powerful for notebook users, because when I switch to standby or hybernate and come back on in my lesson of my uni I don't have to hope I didn't forgot to turn music off. Teacher will throw me outside with a big bang kick! 
Title: foo_lock 0.1
Post by: Smiff on 2004-02-07 14:39:59
hehe, for me it's something quite different. when someone leaves music playing, and someone else comes to use the computer, there's no way for person b to turn off person a's music (without turning the speakers off!) lol. this drives certain people crazy as you might expect. there is one quirk that's a result of the way winxp works - if you walk away and allow the screen saver to kick in, the music doesn't stop until you come back and nudge the mouse. this appears to be because xp doesn't actually lock the workstation until the screensaver stops & you see the welcome screen (it doesn't lock when the screensaver starts, as you might expect). i was thinking you could add an option to pause when screensaver starts, but that would be hacky and probably not a good idea to complicate it.

edit: ok wait, it doesn't work for this purpose, at least not yet :/. it has no way of knowing which user locks/unlocks the workstation.. so it resumes the wrong instance(s) when a new user logs on. shame. can anything be done about this dear plugin author? could this plugin be expanded to do what i was hoping it would do? perhaps you can't even test it if you don't have xp.
Title: foo_lock 0.1
Post by: anton on 2004-02-09 10:14:22
Very cool plugin, thank you!

But, as it was already spoken, music starts to play, when the screensaver is started.
Title: foo_lock 0.1
Post by: kode54 on 2004-02-09 16:19:28
I didn't fix the screen saver problem, but I (hopefully) fixed the multiple user problem.

v0.2 ...
Title: foo_lock 0.1
Post by: Smiff on 2004-02-09 16:35:42
kode54, thanks a lot for taking a look but it still unpauses on another user (v0.2).  anyone else trying this with multi-user xp setup?
Title: foo_lock 0.1
Post by: kode54 on 2004-02-09 17:32:17
Multi-user problem fixed, more Microsoft stupidity.


v0.3 ...
Title: foo_lock 0.1
Post by: Smiff on 2004-02-09 18:49:19
kode, you're a good man. i haven't tested extensively yet but it seems to work  i'll let you know in a day or two if anything odd has shown up. thanks a lot.
Title: foo_lock 0.1
Post by: Kreisquadratur on 2004-02-10 08:04:19
Many thanks kode54, for taking my (your) plugin further on. *g*
I got a problem with the new wtsapi32.h. I got it on my PC because I have intalled VS.Net2003 but it can't compile it with VS6, even if I copy the wtsapi32.h and the wtsapi32.lib. Do you got an answer for that problem?
Title: foo_lock 0.1
Post by: Smiff on 2004-02-10 16:54:55
yes thanks to both of you. the world needs more plugins like this - genuinely useful to normal people (cough well, i'm not normal) and only 11k
Title: foo_lock 0.1
Post by: kode54 on 2004-02-10 21:07:01
foo_lock only needs wtsapi32.h (and maybe a newer PSDK WinUser.h) for the WTS macros. It does not need the library, because it imports the functions itself. The reason for this is because that dll is only supposed to exist in NT 5.1 or newer, so it falls back on the timer-based polling if it fails to import those functions. (or register the class, or create the window...)

needed from wtsapi32.h:
Code: [Select]
#define NOTIFY_FOR_THIS_SESSION 0


needed from winuser.h: *
Code: [Select]
#define WM_WTSSESSION_CHANGE 0x02B1
#define WTS_CONSOLE_CONNECT 0x1
#define WTS_CONSOLE_DISCONNECT 0x2
#define WTS_SESSION_LOCK 0x7
#define WTS_SESSION_UNLOCK 0x8


Or, the updated PSDK headers that I use with VC6: [download (http://www.cqasys.com/projects/kode54/wtsapi32.zip)]

* Blocked out by #if _WIN32_WINNT >= 0x0501, but the dynamic loading in CSessionWnd Initialize function should prevent the code which uses these from ever executing on pre-NT5.1 systems anyway. Polling for 2000, Windows Terminal Services API for XP, 2003 Server, and newer.
Title: foo_lock 0.1
Post by: Kreisquadratur on 2004-02-10 21:28:17
ah, thanks dude. My winuser.h was not that new. wtsapi32.h was.
Title: foo_lock 0.1
Post by: Smiff on 2004-02-11 11:27:00
i've been thinking about the 'screensaver problem' - don't change anything!

- if you walk away from your computer, you might well want the music to play on as you listen and do other things (i often do)
- when someone interrupts the screensaver, that could be you coming back (slight pause, too bad) or someone else wanting to use the computer. there's no reasonable way to be sure, so it's better to pause in case it's someone else imho.

ok perhaps that's really stupid but that's what i thought..
Title: foo_lock 0.1
Post by: Smiff on 2004-02-22 15:33:22
just to repeat (because i don't think this plugin has got enough attention) this plugin is great. just for the convenience of only having to lock the computer each time and letting it handle the pausing/unpausing is worth it. can i go so far as to suggest this is included in the standard foobar package, because this (pause when switching users) is something that every audio player should do i think. you might even want to default it to on! yes it's that good! ok point made, i think this is something more people would use if they knew about it. and having it in the installer would save me having to unzip it for every computer heh

edit: make sure you are downloading the latest that kode54 posted, not the one at the top of the thread.

edit2: it would be cool to get feedback from other people using this (?) to make sure there's no weird quirks. obviously plugins included with foobar must be well tested first, i'd think.
Title: foo_lock 0.1
Post by: kode54 on 2004-02-24 21:49:19
v0.4 [binary (http://www.cqasys.com/projects/kode54/foo_lock.zip)] [source (http://www.cqasys.com/projects/kode54/foo_lock_src.zip)]

Oi, see what happens when you don't clean up properly. Disable function is now saner, so we shouldn't be seeing any crashes on shutdown if user enabled and then disabled first. (XP/2003 only... I don't think KillTimer crashes if fed an illegal timer handle...)
Title: foo_lock 0.1
Post by: Smiff on 2004-02-24 22:16:34
ok, well done, see i never turn it off 

kode i was going to msg you but i might aswell add it here: could you maybe add a "plugins i worked on" section to your page, i.e. not just the plugins you started?
Title: foo_lock 0.1
Post by: kode54 on 2004-02-25 02:57:01
I did not start all of the components listed on my page.
Title: foo_lock 0.1
Post by: Andrea on 2004-03-06 22:19:02
It doens't work on Windows 2003 

Any chance you can fix it?  It's a great idea!
Title: foo_lock 0.1
Post by: Xenion on 2004-03-06 22:19:59
Quote
It doens't work on Windows 2003 

Any chance you can fix it?  It's a great idea!

works here
Title: foo_lock 0.1
Post by: Andrea on 2004-03-06 22:21:40
Did you do anything special to make it work?

The only "strange" component I have is winamp_spam, and I'm using Kernel Streaming...

edit: oh yes, I'm also not running a different shell (not explorer). It's Geoshell. Do you think that might be the problem ? 

edit2: Im my the other machine, with Windows XP and Explorer as the shell, doens't work either 
Title: foo_lock 0.1
Post by: kode54 on 2004-03-06 22:36:39
Administrator group accounts?
Title: foo_lock 0.1
Post by: Moneo on 2004-03-06 22:37:45
A silly question to Andrea: have you enabled it?

Components - pause on lock.
Title: foo_lock 0.1
Post by: Andrea on 2004-03-06 22:45:00
I feel so silly
 

Sorry about that! I misses that option, I was looking for it in the preferences window 

Thanks!
Title: foo_lock 0.1
Post by: kode54 on 2004-03-06 22:52:11
Maybe it needs documentation.
Title: foo_lock 0.1
Post by: Xenion on 2004-03-06 22:52:46
Quote
Maybe it needs documentation.

lol 
Title: foo_lock 0.1
Post by: Zheele on 2004-04-04 12:29:07
Suggestions for future development (if any):

* Make an option to disable playback during the screensaver (if possible), i use this at work and when the screensaver turns on (i cannot disable it due to profile restrictions) the playback resumes.
* Make the "pause on lock" option enabled from the start when you install the plugin, one might assume that when you download and install the plugin it is that functionality you want?
Title: foo_lock 0.1
Post by: kode54 on 2004-04-13 13:46:16
Uploaded new binary and source in the same place, without incrementing the version number.

Silly me, registering main thread windows with modeless_dialog_manager is only necessary if they need to receive user input messages. Definitely not needed for message windows.
Title: foo_lock 0.1
Post by: ronyzyz1 on 2004-04-14 12:02:59
Silly you indeed.
Title: foo_lock 0.1
Post by: Zheele on 2004-04-23 09:27:04
If anyone is interested you can use this function to see if the screensaver is running (not on windows 95/98 though):

bool isScreensaverRunning;
SystemParametersInfo(SPI_GETSCREENSAVERRUNNING, 0, &isScreensaverRunning, 0);

http://msdn.microsoft.com/library/default....ametersinfo.asp (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/systemparametersinfo.asp)

If I can find someplace where I can use Visual Studio I'll give it a try and see if I can add the option to pause during the screensaver too.
Title: foo_lock 0.1
Post by: Poleh on 2005-04-20 02:42:29
anyone got a working download link for this plugin ? I checked the 3rd Party Plugons page, which lists the version as 0.4 but when you install it Fooby reports 0.1 ...
Title: foo_lock 0.1
Post by: bustacap2k3 on 2005-04-20 06:12:06
I love you for this plugin -- my sister always goes on my computer (on her useraccount) and I always forget to turn off my music.

I have a question though, sometimes when pause my music, then manually "switch user" on XP so my workspace is locked (I require a password to login), after 10 minutes, when my screensaver is activated, the music starts playing again. Is there any remedy?
(I remedied this myself by simply stopping my music, but sometimes it's nice to be able to pause it then log out manually.)

Kreisquadratur & Kode, keep up the good work.
Title: foo_lock 0.1
Post by: Kreisquadratur on 2005-04-20 07:34:44
Well, there seems to be something buggy with the http://pelit.koillismaa.fi/ (http://pelit.koillismaa.fi/) upload feature. I weren't able to upload the new versioned files, and Kode54 also seems to be not reachable.

But here is my link: http://www.kreisquadratur.de/Download/foo_lock.zip (http://www.kreisquadratur.de/Download/foo_lock.zip)

Maybe this fixes Bustacap2k3's problem as well as he could maybe have just version 0.1.
Title: foo_lock 0.1
Post by: bustacap2k3 on 2005-04-20 07:39:21
Ah hah, you're right, I did have 0.1 of foo_lock. I will let you know tomorrow if this fixes my problem as I do not have the 10 minutes to test it right now. Thanks for the update 
Title: foo_lock 0.1
Post by: Storm on 2005-04-20 22:30:15
Truly indispensable plugin. Thanks a bunch.
Title: foo_lock 0.1
Post by: Andrea on 2005-04-21 01:59:13
YaY! I hope it stays paused when the SS activates
Title: foo_lock 0.1
Post by: bustacap2k3 on 2005-04-21 02:43:47
Yep, with 0.4, it stays paused when the screensaver activates.
Title: foo_lock 0.1
Post by: Squeller on 2005-04-21 10:25:52
CONGRATULATIONS!

(Not for the plugin, as I do not need it; but COOL USERNAME indeed!)
Title: foo_lock 0.1
Post by: dzid_ on 2012-01-13 15:12:50
It even works with foo_scheduler. I was afraid Foobar will be paused after waking up pc from sleep by scheduler. But it plays like charm.
But why am I writing this.. some of you are probably dead by now.
Thus sorry for interrupting 
Cheers anyway
Title: foo_lock 0.1
Post by: Porcus on 2012-01-13 21:26:29
It even works with foo_scheduler. I was afraid Foobar will be paused after waking up pc from sleep by scheduler. But it plays like charm.
But why am I writing this.. some of you are probably dead by now.
Thus sorry for interrupting 
Cheers anyway


Hm! Tested it just because you awoke the thread.

Crashes my fb2k, probably incompatible with something.