FW: iTunes COM access

"Christophe Bouhier (MC/ECM)" <[email protected]>
Newsgroups gmane.comp.windows.devel.jawin
Message-ID <6BA346EB59B2D51194E200508B046FE1065B74FC@emyklnt151.ao.ericsson.se>
Hi,

I just recently started to use jawin in an attempt to access iTunes COM
interface.
I managed to do so successfully, however having difficulties in some areas.

First using the TLB, It generates the .java source nicely, but when building
the iTunes
package, it turns out that some methods don't have a return type set, so the
class
containing this method obviously won't compile. I understand from the hint,
that
I should use Dispatch instead as this type is not implemented?

example:

    /**
    *
    * @return
    **/
    public  getDateAdded() throws COMException
    {
        return null; // not implementedget("DateAdded");
    }

So, I filled in manualy the return type to "void" to compile the package (I
don't need this specific
object). according to the iTunes SDK, only the iTunesApp class can be
instantiated. I can
do so, but still can not access the relevant methods which are in the
IiTunes class. Can someone
give it a try, and tell me how to do this?

Next, failing to use the stub class, I used the Dispatch instead, which
worked fine until I was trying to do the following:

        DispatchPtr library = app.getObject("LibrarySource");
        DispatchPtr playLists = library.getObject("Playlists");
        playList = playLists.getObject("ItemByName", playListName);
        DispatchPtr trackCollection = playList.getObject("Tracks");
        DispatchPtr track = trackCollection.getObject("ItemByName",
trackName);

The following code snip works fine until the last line:

DispatchPtr track = trackCollection.getObject("ItemByName", trackName).
'trackName' in this case is a String which is the name of a song which is
NOT in the playlist,
so the result I expect is 'null', but that doesn't happen?

Actually I would like to use another method which is called 'Item', but here
I have no idea
on how to pass an 'long' type with the method getObject(). The call should
be something
like this:

for( int index=0; index < numOfTracks; index++) {
  DispatchPtr track = trackCollection.getObject("Item", Long(index)). //
This doens'work
  //...rest of code.
}

All help will be very weclome, if someone has iTunes installed, I would
really appreciate
if you can simulate and advise ( I am sure I am doing something wrong, I
just explored jawin from last week only).

Thanks a zillion / Christophe Bouhier
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.