用于Windows的java文件图标覆盖 [英] File icon overlay in java for windows

查看:153
本文介绍了用于Windows的java文件图标覆盖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在文件和文件夹上实现图标覆盖,就像Tortoise SVN或Dropbox一样。

I am trying to implement icon overlaying on files and folders just like Tortoise SVN or Dropbox does.

我在互联网上做了很多搜索,但我找不到Java解决方案。

I did a lot of searching on the Internet, but I cannot find a solution in Java.

可以有人帮我这个吗?

Can anyone help me with this?

推荐答案

很抱歉确认您的担心,但无法用Java完成。

I am sorry to confirm your fears, but it can't be done in Java.

由于Windows资源管理器是控件,Icon Overlay是一种插件。它必须实现为DLL(不是JNI,而是真正的本机DLL),并在Windows注册表中注册。正如您在 CodeProject 文章中看到的那样,您的DLL必须实现特定的接口 - IShellIconOverlayIdentifier

Since the Windows Explorer is the one in control, Icon Overlay is sort of a plug-in. It has to be implemented as a DLL (not a JNI but a true native DLL), and registered in the Windows Registry. As you saw in CodeProject article, your DLL has to implement specific interface - IShellIconOverlayIdentifier.

TortoiseSVN实施<为例/ a>。

Take for example the TortoiseSVN implementation.

TortoiseSVN的DLL由资源管理器加载并附加到其进程:

TortoiseSVN's DLL is loaded by the Explorer and attached to its process:

DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /* lpReserved */)
{
  ...
  if (dwReason == DLL_PROCESS_ATTACH)
  ...

为了在Java中执行此操作,您需要编写一个可以加载JVM的DLL,你的JAR就是一种矫枉过正。

In order to do this in Java you would need to write a DLL that would load the JVM and your JAR which would be an overkill.

对于托盘图标覆盖,你的Java应用程序是一个可以控制的应用程序,所以它可以完成。

As for the Tray Icon overlay, your Java application is the one in control so it can be done.

这篇关于用于Windows的java文件图标覆盖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆