Writing Java Plugins for Total Commander

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: Hacker, petermad, Stefan2, white

CoolWater
Power Member
Power Member
Posts: 744
Joined: 2003-03-27, 16:33 UTC

Post by *CoolWater »

kenchis wrote:Hi Frenky,

Could you give me some help for the plugin?

I have got a problem with the fsExtractCustomIcon function.
I want to return a HICON, but i dont know what the best solution is.
1. Should Java create an icon and convert it to hicon (what format is that?) or
2. Should Java return the icon name and native C should load this.

i tried 2nd for simplicity,
but my C-code does not work:

if (strlen(iconName) > 0)
{
HICON myIcon = NULL;
if(ExtractFlags & 1) {
myIcon = (HICON)LoadImage(theDll, MAKEINTRESOURCE(iconName), IMAGE_ICON, 16, 16, 0);
TheIcon = &myIcon;
} else {
myIcon = (HICON)LoadImage(theDll, MAKEINTRESOURCE(iconName), IMAGE_ICON, 32, 32, 0);
TheIcon = &myIcon;
}
}
====================
I found this somewhere in the forum.
Does that mean, that the icon has to be located in my DLL?
I want better a solution, where it can be loaded from my plugin directory.

Thank you for support,

Kenchi
Hi there,

maybe you should change your LoadImage function call to:

Code: Select all

if (strlen(iconName) > 0) 
	{ 
		HICON myIcon = NULL; 
		if(ExtractFlags & 1) {
			myIcon = (HICON)LoadImage(theIconFile, MAKEINTRESOURCE(iconName), IMAGE_ICON, 16, 16, LR_LOADFROMFILE); 
			TheIcon = &myIcon;
		} else {
			myIcon = (HICON)LoadImage(theIconFile, MAKEINTRESOURCE(iconName),  IMAGE_ICON, 32, 32, LR_LOADFROMFILE);
			TheIcon = &myIcon;
		}
	}
Btw. I'm not quite sure if MAKEINTRESOURCE(iconName) does really work since MAKEINTRESOURCE is usually used for identifiers and not for strings... Maybe you should try it without MAKEINTRESOURCE...

Much luck,
CoolWater
User avatar
Lefteous
Power Member
Power Member
Posts: 9537
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

2kenchis
Hi,

The download and the source link point to the same archive. Is it intentional?
kenchis
Junior Member
Junior Member
Posts: 53
Joined: 2006-02-04, 11:44 UTC
Location: Berlin
Contact:

About the Icons

Post by *kenchis »

Hi Coolwater,

thank you for your help.
Displaying icons is one of the things, that i didnt get to function, until now,
because i dont know anything about icons in windows applications.
If your code block works it should be easy to add icons to file system plugins, for example. The format of the icon file is unknown to me (could you give me a hint to a icon tool as well?)
I will test it in next time.

2Lefteous:
Yes, the download link points to the same address than the sources link.
At the moment, a binary download is obsolete, because every installer comes up with the binary distribution.
The next step will be to provide downloads to a complete developement environment and CVS access to all sources (native code and java plugins).

Kind Regards,

Ken

P.S. Happy "Herrentag"
User avatar
Lefteous
Power Member
Power Member
Posts: 9537
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

2kenchis
Okay I think I have to take a closer look at your java plug-in world.
The format of the icon file is unknown to me
Take a look here. Although in Delphi it's readable: http://www.delphipraxis.net/post102336.html

First the icondir structure, then one or more icondirentry structures.
kenchis
Junior Member
Junior Member
Posts: 53
Joined: 2006-02-04, 11:44 UTC
Location: Berlin
Contact:

Version 1.5 available

Post by *kenchis »

Hello Lefteos, hi everyone,
this is my last update before my holidays start.

Have a look at the installers if you like and watch the project documentation containing checkstyle report and Java API.
The plugins itself are more Total Commander style now (filenames are pluginName.wlx, etc.)

Next step for the next version (again) is CVS access to the sources and the developement environment for download?

http://www.totalcmd.net/plugring/tc_java.html

Best Regards,
Ken[/url]
kenchis
Junior Member
Junior Member
Posts: 53
Joined: 2006-02-04, 11:44 UTC
Location: Berlin
Contact:

Post by *kenchis »

Lefteous wrote:2kenchis
Okay I think I have to take a closer look at your java plug-in world.
The format of the icon file is unknown to me
Take a look here. Although in Delphi it's readable: http://www.delphipraxis.net/post102336.html

First the icondir structure, then one or more icondirentry structures.
Hi Lefteous,

thank you for your info. Next time i will have icons for file system plugins.

But for now i am on holiday :-)
Gruß,
Kenchi
kenchis
Junior Member
Junior Member
Posts: 53
Joined: 2006-02-04, 11:44 UTC
Location: Berlin
Contact:

Java Plugin Interface

Post by *kenchis »

Hi folks,

finally i released a new version of my Java Plugin Interface.
- Now there is full support for TC Version 7
- First 3rd party plugin (SNMP)
- Now with icon and preview bitmap support missing so far

Please feel free to visit my page:
http://www.totalcmd.net/plugring/tc_java.html

Last update for the next time (my childs birth is very near)

Best regards,
Ken
Gruß,
Kenchi
kenchis
Junior Member
Junior Member
Posts: 53
Joined: 2006-02-04, 11:44 UTC
Location: Berlin
Contact:

Next Version

Post by *kenchis »

Hi people,

Version 1.7 is out now.
Please visit my page and give me (positive or negative) feedback.

Best regards,
Ken
CoolWater
Power Member
Power Member
Posts: 744
Joined: 2003-03-27, 16:33 UTC

Post by *CoolWater »

Hey ken,

Is there a possibility to add a "network neighborhood friendly name"? Now, your framework takes the CLASS entry from WFX section in tc_javaplugin.ini, right? There should be an entry to show a (more) user-friendly name in network neighborhood.

Regards,
CoolWater
kenchis
Junior Member
Junior Member
Posts: 53
Joined: 2006-02-04, 11:44 UTC
Location: Berlin
Contact:

Post by *kenchis »

Hi Coolwater,

the class name from tc_javaplugin.ini does not define the name of the Root file system.
Instead a specific method return value in java, that is in the case of my plugins the class name:

Code: Select all

java.lang.String	fsGetDefRootName(int maxlen) {
  return getClass().getName();
}
This is similar to the native plugins.
I dont want to make it another way. Everything should be defined in java.

Best regards,
Ken[/code]
CoolWater
Power Member
Power Member
Posts: 744
Joined: 2003-03-27, 16:33 UTC

Post by *CoolWater »

kenchis wrote:Hi Coolwater,

the class name from tc_javaplugin.ini does not define the name of the Root file system.
Instead a specific method return value in java, that is in the case of my plugins the class name:

Code: Select all

java.lang.String	fsGetDefRootName(int maxlen) {
  return getClass().getName();
}
This is similar to the native plugins.
I dont want to make it another way. Everything should be defined in java.

Best regards,
Ken[/code]
Ok, sounds good ;)

When I try to make an eclipse projekt using your tc_apis*.jar I get an UnsatisfiedLinkError for tc.library.name. Can you tell me what I need to add to the VM args within eclipse to make it work? I took the Drives plugin as example.

Thanks and Regards,
CoolWater
kenchis
Junior Member
Junior Member
Posts: 53
Joined: 2006-02-04, 11:44 UTC
Location: Berlin
Contact:

Post by *kenchis »

Hi Coolwater,

tc.library.name is not a system property to set in eclipse.
You can not test the plugin in Eclipse that way.

Only if the plugin class is loaded by the PluginClassloader, the constant library name "tc.library.name" is mapped to the DLL of the native Total Commander plugin file.

You should test the Java GUI standalone and if it works, you should embed it in your plugin class and Test it by calling Total Commander and starting your plugin.

Testing without TC is not easily possible :-(
Perhaps i should create a possibility.
Gruß,
Kenchi
User avatar
Nigurrath
Senior Member
Senior Member
Posts: 225
Joined: 2003-02-05, 12:41 UTC

Post by *Nigurrath »

Hi all,
I have realized lately that I have a strange problem with a java plugin (SNMP Plugin). The problem seems anyway to be associated to the java environment of that plugin only.

The error is this:

Class not found class='tcclassloader/PlugiClassLoader'. Please korrect the class name ecc ecc

I have other java plugins, like for example the JAD one and they are instead working fine, without problems. It seems like only this special plugin has problems..

I installed the plugins in the default locations, so as .ini files are pointing to the correct locations.

any help?
always latest 32b TC on a WIN10 64b
kenchis
Junior Member
Junior Member
Posts: 53
Joined: 2006-02-04, 11:44 UTC
Location: Berlin
Contact:

Post by *kenchis »

Hello,

as far as i remember it could be the java version.
Some plugins use 1.6 features, so maybe?

The java version is normally detected by searching in the registry.
And there is also a strangeness with JRE:
If you uninstall a java version, the registry key can become invalid.

Check the following key with regedit:
path: HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Runtime Environment
key: CurrentVersion
value should be: 1.6

There shoud be a path:
HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Runtime\\1.6
key: RuntimeLib
value should point to a valid jvm.dll in the Java home directory

But, if its true, that if JAD plugin works, it maybe only the version, thats wrong.

Regards,
Ken
Gruß,
Kenchi
User avatar
Nigurrath
Senior Member
Senior Member
Posts: 225
Joined: 2003-02-05, 12:41 UTC

Post by *Nigurrath »

Hi,
thanks kenchis I checked it and the registry keys and path are ok and as you told.

How one can understand which version of java the plugin is supposed to have? Beside the plugin documentation, that is not telling much in this case, as far as I can see
always latest 32b TC on a WIN10 64b
Post Reply