Adjust volume and prevent computer from standby in Java… (Mac and Windows XP, Vista)

隐身守侯 提交于 2019-12-25 04:38:36

问题


I am writing a Java program that wants to do 3 things, and I don't know how to do them or if it's even possible with Java.

1 - I want to ensure that the computer whether running mac OS or windows xp/vista, doesn't go to sleep whilst running my app.

2 - I want my app to be able to turn the volume to full on all of the above OS's before playing a sound.

3 - Finally, when a sound is played I want to make sure that the screen, if turned off for 'power saving', is switched on.

Is any of this possible? I saw this post which suggested javax.sound.* as an answer to (2), but does that work on OS X and Windows XP, Windows Vista?

If anyone knows I would be very grateful.

EDIT: The app is a wi-fi LAN communications program that allows a user using the "client" software to pop up a message on any computer on the network running the "server" software. The software must notify the user even if they are not at the computer, hence the requirements for it to be always on (no support for WOL over wi-fi) and for it to make alot of noise & wake the screen to display any messages.


回答1:


For part 1, you might want to look at the OnNow/ACPI Support for Windows and the likes of ES_DISPLAY_REQUIRED. Not Java, but you're probably going to have to go native or find a 3rd party wrapper library for this type of control.



来源:https://stackoverflow.com/questions/1330560/adjust-volume-and-prevent-computer-from-standby-in-java-mac-and-windows-xp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!