這是我在stackoverflow上找到的。我要尋找一個Java類來改變窗口的牆紙,我在Windows 7如何在java中設置windows壁紙
public class changewallpaper {
public static void main(String[] args) {
//supply your own path instead of using this one
String path = "C:\\Users\\d1j5\\Pictures\\asgardrealmofthegods.jpg";
SPI.INSTANCE.SystemParametersInfo(
new UINT_PTR(SPI.SPI_SETDESKWALLPAPER),
new UINT_PTR(0),
path,
new UINT_PTR(SPI.SPIF_UPDATEINIFILE | SPI.SPIF_SENDWININICHANGE));
} public interface SPI extends StdCallLibrary {
//from MSDN article
long SPI_SETDESKWALLPAPER = 20;
long SPIF_UPDATEINIFILE = 0x01;
long SPIF_SENDWININICHANGE = 0x02;
SPI INSTANCE = (SPI) Native.loadLibrary("user32", SPI.class, new HashMap<Object, Object>() {
{
put(OPTION_TYPE_MAPPER, W32APITypeMapper.UNICODE);
put(OPTION_FUNCTION_MAPPER, W32APIFunctionMapper.UNICODE);
} }); boolean SystemParametersInfo(
UINT_PTR uiAction,
UINT_PTR uiParam,
String pvParam,
UINT_PTR fWinIni
);
}
}
source for the code from stackoverflow
問題是什麼? – 2012-07-06 21:55:27
好的,你發現了,發生了什麼? – Alfabravo 2012-07-06 21:59:00
我沒有完成它發佈時,但問題是如何,示例代碼是來自另一個職位,不適合我的答案。 – jerhynsoen 2012-07-06 22:12:52