Autor Beitrag
greyhound
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21



BeitragVerfasst: Mo 09.01.06 11:52 
Hallo Forum,

für iTunes gibt es ein COM-SDK, allerdings nur in C. Hat jemand bereits mit Delphi sich an iTunes versucht?

Gruß,
greyhound
MrSaint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1033
Erhaltene Danke: 1

WinXP Pro SP2
Delphi 6 Prof.
BeitragVerfasst: Mo 09.01.06 13:38 
COM-Schnittstellen können theoretisch mit allen Programmiersprchen benutzt werden. In Delphi wird das voll unterstützt. Um die "Header" zu bekommen geh in deinem Delphi mal auf Projekt->Typbibliothek importieren. Da suchst du dann nach irgendwas was mit iTunes zu tun hat und importierst das dann.
Damit, mit der Hilfe der Beschreibung von Apple unter developer.apple.com/sdk/itunescomsdk.html und ein paar COM-Grundlagen sollte das schon fast ein Kinderspiel werden ;) Ich selbst hab aber noch nie mit iTunes kommuniziert...



MrSaint

_________________
"people knew how to write small, efficient programs [...], a skill that has subsequently been lost"
Andrew S. Tanenbaum - Modern Operating Systems
greyhound Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21



BeitragVerfasst: Mo 09.01.06 14:22 
@MrSaint: Danke für den Tipp, das Importieren hat funktioniert.

Die Frage ist nun, wie ich das iTunes Objekt erstelle, leider habe ich keine Erfahrungen mit COM. Die entsprechenden Klassen haben anscheinend keine create-Methode, oder ich wende sie falsch an.

Wie wäre dieser C++-Code denn in Delphi zu übersetzen (aus der SDK):

#include "iTunesCOMInterface.h"

HRESULT hRes;
IiTunes iITunes;

// note - CLSID_iTunesApp and IID_IiTunes are defined in iTunesCOMInterface_i.c
hRes = ::CoCreateInstance(CLSID_iTunesApp, NULL, CLSCTX_LOCAL_SERVER, IID_IiTunes, (PVOID *)&iITunes);

Gruß,
greyhound
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Mo 09.01.06 16:08 
Als erstes musste die durch importieren der Typbibliothek erstellte Unit in Uses aufnehmen. Bei mir heißt die iTunesLib_TLB.
Dann brauchste eine globale Variable vom Typ iTunesApp, die du dann mit iTunes:=coiTunesApp.Create; initialisierst, wobei iTunes bei mir die globale Variable ist.. (Am besten im Form.Create)
Dann kannste mit iTunes.irgendwas auf iTunes zugreifen.

P.S.: Wie man Ereignisse verarbeitet habi ich noch nich raus.

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
MrSaint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1033
Erhaltene Danke: 1

WinXP Pro SP2
Delphi 6 Prof.
BeitragVerfasst: Mo 09.01.06 16:37 
Events sind in COM im Normalfall leider etwas komplizierter als in Delphi. Mir hat schon ein paar mal das Tool EventSinkImp weitergeholfen. Pobiert doch da mal mit rum ;)



MrSaint

_________________
"people knew how to write small, efficient programs [...], a skill that has subsequently been lost"
Andrew S. Tanenbaum - Modern Operating Systems
greyhound Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21



BeitragVerfasst: Mo 09.01.06 17:33 
@jakobwenzel: Danke für den Tipp, soweit war ich allerdings schon durch CreateOLEObject gekommen. Deine Lösung ist aber eleganter.

Im Prinzip kann ich nun alles steuern abgesehen von der angezeigten Sortierreihenfolge von Playlists, das scheint es einfach nicht zu geben. Schade.

Events zu verarbeiten wäre aber auch noch interessant.
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Di 10.01.06 20:42 
user profile iconMrSaint hat folgendes geschrieben:
Events sind in COM im Normalfall leider etwas komplizierter als in Delphi. Mir hat schon ein paar mal das Tool EventSinkImp weitergeholfen. Pobiert doch da mal mit rum ;)



MrSaint


Das hatt ich schon ma probiert, aber das meckert, dass da eine benötigte EXE nich da wär.
Liegt wahrscheinlich daran, dass ich die Personals habe.

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
MrSaint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1033
Erhaltene Danke: 1

WinXP Pro SP2
Delphi 6 Prof.
BeitragVerfasst: Di 10.01.06 21:20 
hast du shcoinmal per hand nach der Datei gesucht? bei mir ist die im Delphi\bin verzeichnis und heißt TLibImp.exe. du kannst den pfad zu der in EventSinkImp auch per Hand eintragen!



MrSaint

_________________
"people knew how to write small, efficient programs [...], a skill that has subsequently been lost"
Andrew S. Tanenbaum - Modern Operating Systems
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Mi 11.01.06 15:49 
Das Prog gibts bei mir weder im Verzeichnis von der 7 Pers. noch von der 2005er. :cry:
Muss mir wohl mal ne Demo von nem aktuellen Delphi saugen. :roll:

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
max120b
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 33

WinXP, Linux 9.0
Delphi 2005 Professional
BeitragVerfasst: Di 02.01.07 17:54 
HI...ich weis zwar nicht, ob das Thema noch aktuell ist, oder ob du es inzwischen hinbekommen hast aber ich hab was insteressantes gefunden, was dir helfen könnte.

Ich bastel selber grad an nem Programm rum, das mit ITunes zu tun hat....und ich hab genau wie du Delphi 2005.

Ich hab versucht das ITunes SDk zu importieren...und habe dabei das hier entdeckt:

Wenn man eine Typenbibliothek inportieren will, gibt Delhi einem eine Liste mit installierten DLLs aus...und da hab ich das hier gefunden:
[url=img107.imageshack.us...php?image=03ax7.jpg]user defined image[/URL][url=img107.imageshack.us...php?image=04tm7.jpg]user defined image[/URL]

importiert man die Itunes Type Libary 1.8 erhält man die bereits oben erwähnte iTunesLib_TLB - Uses. Darin sind viele nützliche sachen enthalten für den Umgang mit Itunes ;)

so zum Beispiel dies hier:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
    procedure BackTrack; dispid 1610743808;
    procedure FastForward; dispid 1610743809;
    procedure NextTrack; dispid 1610743810;
    procedure Pause; dispid 1610743811;
    procedure Play; dispid 1610743812;
    procedure PlayFile(const filePath: WideString); dispid 1610743813;
    procedure PlayPause; dispid 1610743814;
    procedure PreviousTrack; dispid 1610743815;
    procedure Resume; dispid 1610743816;
    procedure Rewind; dispid 1610743817;
    procedure Stop; dispid 1610743818;



Hoffe das hilft dir weiter ;)


edit: *ups* hab vergessen zu erähnen, dass Itunes natürlich installiert sein muss, damit die DLLs da sind
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Di 02.01.07 18:06 
Das steht schon hier im Thread verteilt :?

Die Events gehn bei mir auch, hab jetz die 2006er Professional und da war die benötigte Datei dabei.

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
Shorty
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 107

Win XP, Ubuntu 8.04
Delphi 7 Prof., Delphi 2005 Pers.
BeitragVerfasst: Fr 12.01.07 00:02 
Wo steht das denn bei Delphi 2005 mit dem Komponenten importieren? Find das irgendwie nicht...
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Fr 12.01.07 00:06 
Falls du die Personal Edition hast: Die unterstützt das nicht, weil sie Personal ist!