Ever use Limewire on Windows? Notice that cool-ass tray icon they use? So have I... and because Limewire is open source (GPL, dammit!) I went and downloaded the code (this is months ago, actually) and ripped it apart to see how the tray-icon worked. Very simple - it's a little DLL they built using Borland's free C Compiler linked up to their app via a little (and I mean very little) JNI. It's sweet. But it's also unusable by me.
Now, I had done the research (I swear!) and couldn't find any other examples of this, so I reworked the code a bit and used it my code-base. And that's the way it remained for the past year, I think. Now that I'm considering publicizing my code, I knew I needed to fix this fault so I started making plans to rework the code.
So on Monday, I dropped an email to Jim Hughes - a C programmer in the UK I met through blogging - about whether he could help me out creating the DLL. I sent him a zip of the LimeWire stuff and asked him if he thought it was possible to duplicate the functionality without copying the code and he said "easily" so the next night I sent him a quick test-harness and he downloaded the JDK (30+ megs over an ISDN line... oof). The next morning he fished out his Java in a Nutshell book which was gathering dust under his bed and started boning up on JNI on the train to work. After he arrived, he IMed me about the project - which he bit into hard - and we started going over the details of what I was looking for and the best way to implement it.
That's when it dawned on me that I should look for other examples and Googled the subject for the first time in a year and POOF, I quickly found two open versions of the exact same code we were talking about developing! DOH! First, there's Madcap a BSD-licensed Sourceforge project which includes libraries for local access to the Tray app among other functionality - on both Windows and Linux. (Very cool, though I've yet to figure out how to compile the dlls...). And the second is an open Tray Icon project by Jan Struyf (no license it seems). This second one comes with dlls already compiled and is pretty great also... And finally, I found a commercial app called JTray which is ridiculously expensive (but I downloaded it and decompiled it to see what it was doing anyways).
Wow. So I feel a bit bad from getting Jim all revved up only to decide there was no reason (yet) to reinvent the wheel. Both of the open apps are better than the Limewire version because the Limewire stuff has all the menus hard coded in the C code, rather than in the Java code so I'm glad I went through this process (though I had to anyways). I'm going to see if I can get madcap compiled tonight and test both of the libraries out to see which is best and see if they're missing anything huge. Jim has expressed his willingness to help out fixing stuff up in C if I end up needing something. Very cool.
C and C++ by the way, bewilder me. It always seems to make sense in the book, but then I go to compile something and I can't compile crap. Ever. Not even Hello World. I just don't get it.
So anyways, if you happen to be thinking about developing an Aggregator or Weblogging client and are looking for a Tray App solution, here you are.