简体   繁体   English

更新Java中的Windows快捷方式图标

[英]update windows shortcut icon in Java

How can one change the icon image of a pre-existing shortcut through java? 如何通过Java更改现有快捷方式的图标图像? I do not want to change the icon image of a java executable, but have a java program that changes a shortcut's icon image. 我不想更改Java可执行文件的图标图像,但是有一个Java程序可以更改快捷方式的图标图像。

I know I can manually change the icon image by right clicking on a shortcut and going to properties->shortcut->change icon, but I would like to do this through java. 我知道我可以通过右键单击快捷方式并转到properties-> shortcut-> change icon来手动更改图标图像,但是我想通过java来完成。

Its impractical do this in pure java yourself, although the lnk-file format is documented by microsoft ( http://msdn.microsoft.com/en-us/library/dd871305.aspx ), but since it originated with Win95 it underwent significant extensions and redefinitions over the years. 尽管lnk文件格式是由Microsoft( http://msdn.microsoft.com/zh-cn/library/dd871305.aspx )记录的,但是在纯Java中自己这样做是不切实际的,但是由于它起源于Win95,因此经历了重大的变革。这些年来的扩展和重新定义。 Implementing this seems like a daunting task. 实施此任务似乎很艰巨。

You can try to find a library that implements it for you, eg http://ovanttasks.sourceforge.net/ov-native/ may do what you want. 您可以尝试找到一个为您实现它的库,例如http://ovanttasks.sourceforge.net/ov-native/可以满足您的要求。

The alternative would be to use existing Windows API's to do the job (See How do you create (and read) windows shortcut(.lnk file) in Java? ). 替代方法是使用现有Windows API来完成这项工作(请参阅如何在Java中创建(和读取)Windows快捷方式(.lnk文件)? )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM