This interface defines the top-level iTunes application object. All other iTunes interfaces are accessed through this object.
This is the only externally creatable iTunes COM interface. All other iTunes interfaces are accessed through this interface. It can be created using the iTunesApp class.
To create an IiTunes object from C++:
#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);
To create an IiTunes object from C#:
iTunesLib.IiTunes iTunesApp;
iTunesApp = new iTunesLib.iTunesAppClass();
To create an IiTunes object from Visual Basic:
Imports iTunesLib
Dim iTunesApp as new iTunesApp
To create an IiTunes object from VBScript:
Dim iTunesApp;
Set iTunesApp = WScript.CreateObject("iTunes.Application");
To create an IiTunes object from JScript:
var iTunesApp = WScript.CreateObject("iTunes.Application");
To create an IiTunes object from Perl:
$iTunesApp = new Win32::OLE("iTunes.Application");
Public Member Functions | |
Player Controls | |
HRESULT | BackTrack () |
Reposition to the beginning of the current track or go to the previous track if already at start of current track. | |
HRESULT | FastForward () |
Skip forward in a playing track. | |
HRESULT | NextTrack () |
Advance to the next track in the current playlist. | |
HRESULT | Pause () |
Pause playback. | |
HRESULT | Play () |
Play the currently targeted track. | |
HRESULT | PlayFile ([in] BSTR filePath) |
Play the specified file path, adding it to the library if not already present. | |
HRESULT | PlayPause () |
Toggle the playing/paused state of the current track. | |
HRESULT | PreviousTrack () |
Return to the previous track in the current playlist. | |
HRESULT | Resume () |
Disable fast forward/rewind and resume playback, if playing. | |
HRESULT | Rewind () |
Skip backwards in a playing track. | |
HRESULT | Stop () |
Stop playback. | |
HRESULT | GetPlayerButtonsState ([out] VARIANT_BOOL *previousEnabled,[out] ITPlayButtonState *playPauseStopState,[out] VARIANT_BOOL *nextEnabled) |
Retrieves the current state of the player buttons in the window containing the currently targeted track. If there is no currently targeted track, returns the current state of the player buttons in the main browser window. | |
HRESULT | PlayerButtonClicked ([in] ITPlayerButton playerButton,[in] long playerButtonModifierKeys) |
Simulate a click on a player control button in the window containing the currently targeted track. If there is no currently targeted track, simulates a click on a player control button in the main browser window. | |
Conversion Methods | |
HRESULT | ConvertFile ([in] BSTR filePath,[out, retval] IITOperationStatus **iStatus) |
Start converting the specified file or folder. | |
HRESULT | ConvertFiles ([in] VARIANT *filePaths,[out, retval] IITOperationStatus **iStatus) |
Start converting the specified files and/or folders. | |
HRESULT | ConvertTrack ([in] VARIANT *iTrackToConvert,[out, retval] IITOperationStatus **iStatus) |
Start converting the specified track. | |
HRESULT | ConvertTracks ([in] VARIANT *iTracksToConvert,[out, retval] IITOperationStatus **iStatus) |
Start converting the specified tracks. | |
HRESULT | ConvertFile2 ([in] BSTR filePath,[out, retval] IITConvertOperationStatus **iStatus) |
Start converting the specified file or folder. | |
HRESULT | ConvertFiles2 ([in] VARIANT *filePaths,[out, retval] IITConvertOperationStatus **iStatus) |
Start converting the specified files and/or folders. | |
HRESULT | ConvertTrack2 ([in] VARIANT *iTrackToConvert,[out, retval] IITConvertOperationStatus **iStatus) |
Start converting the specified track. | |
HRESULT | ConvertTracks2 ([in] VARIANT *iTracksToConvert,[out, retval] IITConvertOperationStatus **iStatus) |
Start converting the specified tracks. | |
Miscellaneous Methods | |
HRESULT | CheckVersion ([in] long majorVersion,[in] long minorVersion,[out, retval] VARIANT_BOOL *isCompatible) |
Returns true if this version of the iTunes type library is compatible with the specified version. | |
HRESULT | GetITObjectByID ([in] long sourceID,[in] long playlistID,[in] long trackID,[in] long databaseID,[out, retval] IITObject **iObject) |
Returns an IITObject corresponding to the specified IDs. | |
HRESULT | CreatePlaylist ([in] BSTR playlistName,[out, retval] IITPlaylist **iPlaylist) |
Creates a new playlist in the main library. | |
HRESULT | OpenURL ([in] BSTR url) |
Open the specified iTunes Store or streaming audio URL. | |
HRESULT | GotoMusicStoreHomePage () |
Go to the iTunes Store home page. | |
HRESULT | UpdateIPod () |
Update the contents of the iPod. | |
HRESULT | Quit () |
Exits the iTunes application. | |
HRESULT | CreateEQPreset ([in] BSTR eqPresetName,[out, retval] IITEQPreset **iEQPreset) |
Creates a new EQ preset. | |
HRESULT | CreatePlaylistInSource ([in] BSTR playlistName,[in] VARIANT *iSource,[out, retval] IITPlaylist **iPlaylist) |
Creates a new playlist in an existing source. | |
HRESULT | SubscribeToPodcast ([in] BSTR url) |
Subscribes to the specified podcast feed URL. Any "unsafe" characters in the URL should already be converted into their corresponding escape sequences, iTunes will not do this. | |
HRESULT | UpdatePodcastFeeds () |
Updates all podcast feeds. This is equivalent to the user pressing the Update button when Podcasts is selected in the Source list. | |
HRESULT | CreateFolder ([in] BSTR folderName,[out, retval] IITPlaylist **iFolder) |
Creates a new folder in the main library. | |
HRESULT | CreateFolderInSource ([in] BSTR folderName,[in] VARIANT *iSource,[out, retval] IITPlaylist **iFolder) |
Creates a new folder in an existing source. | |
HRESULT | GetITObjectPersistentIDs ([in] VARIANT *iObject,[out] long *highID,[out] long *lowID) |
Returns the high and low 32 bits of the persistent ID of the specified IITObject. See the documentation on IITObject for more information on persistent IDs. | |
Collection Properties | |
HRESULT | Sources ([out, retval] IITSourceCollection **iSourceCollection) |
Returns a collection of music sources (music library, CD, device, etc.). | |
HRESULT | Encoders ([out, retval] IITEncoderCollection **iEncoderCollection) |
Returns a collection of encoders. | |
HRESULT | EQPresets ([out, retval] IITEQPresetCollection **iEQPresetCollection) |
Returns a collection of EQ presets. | |
HRESULT | Visuals ([out, retval] IITVisualCollection **iVisualCollection) |
Returns a collection of visual plug-ins. | |
HRESULT | Windows ([out, retval] IITWindowCollection **iWindowCollection) |
Returns a collection of visual plug-ins. | |
Sound Properties | |
HRESULT | SoundVolume ([out, retval] long *volume) |
Returns the sound output volume (0 = minimum, 100 = maximum). | |
HRESULT | SoundVolume ([in] long volume) |
Sets the sound output volume (0 = minimum, 100 = maximum). | |
HRESULT | Mute ([out, retval] VARIANT_BOOL *isMuted) |
Returns true if the sound output is muted. | |
HRESULT | Mute ([in] VARIANT_BOOL shouldMute) |
Sets sound output mute state. | |
Player Properties | |
HRESULT | PlayerState ([out, retval] ITPlayerState *playerState) |
Returns the current player state. | |
HRESULT | PlayerPosition ([out, retval] long *playerPos) |
Returns the player's position within the currently playing track in seconds. | |
HRESULT | PlayerPosition ([in] long playerPos) |
Sets the player's position within the currently playing track in seconds. | |
Encoder Properties | |
HRESULT | CurrentEncoder ([out, retval] IITEncoder **iEncoder) |
Returns the currently selected encoder (AAC, MP3, AIFF, WAV, etc.). | |
HRESULT | CurrentEncoder ([in] IITEncoder *iEncoder) |
Sets the current encoder (AAC, MP3, AIFF, WAV, etc.). | |
Visual Properties | |
HRESULT | VisualsEnabled ([out, retval] VARIANT_BOOL *isEnabled) |
Returns true if visuals are currently being displayed. | |
HRESULT | VisualsEnabled ([in] VARIANT_BOOL shouldEnable) |
Set whether visuals should be displayed. | |
HRESULT | FullScreenVisuals ([out, retval] VARIANT_BOOL *isFullScreen) |
Returns true if the visuals are displayed using the entire screen. | |
HRESULT | FullScreenVisuals ([in] VARIANT_BOOL shouldUseFullScreen) |
Set whether visuals should be displayed using the entire screen. | |
HRESULT | VisualSize ([out, retval] ITVisualSize *visualSize) |
Returns the size of the displayed visual. | |
HRESULT | VisualSize ([in] ITVisualSize visualSize) |
Sets the size of the displayed visual. | |
HRESULT | CurrentVisual ([out, retval] IITVisual **iVisual) |
Returns the currently selected visual plug-in. | |
HRESULT | CurrentVisual ([in] IITVisual *iVisual) |
Sets the current visual plug-in. | |
EQ Properties | |
HRESULT | EQEnabled ([out, retval] VARIANT_BOOL *isEnabled) |
Returns true if the equalizer is enabled. | |
HRESULT | EQEnabled ([in] VARIANT_BOOL shouldEnable) |
Set whether the equalizer should be enabled. | |
HRESULT | CurrentEQPreset ([out, retval] IITEQPreset **iEQPreset) |
Returns the currently selected EQ preset. | |
HRESULT | CurrentEQPreset ([in] IITEQPreset *iEQPreset) |
Sets the current EQ preset. | |
Streaming Properties | |
HRESULT | CurrentStreamTitle ([out, retval] BSTR *streamTitle) |
Returns the name of the current song in the playing stream (provided by streaming server). | |
HRESULT | CurrentStreamURL ([out, retval] BSTR *streamURL) |
Returns the URL of the playing stream or streaming web site (provided by streaming server). | |
Miscellaneous Properties | |
HRESULT | BrowserWindow ([out, retval] IITBrowserWindow **iBrowserWindow) |
Returns the main iTunes browser window. | |
HRESULT | EQWindow ([out, retval] IITWindow **iEQWindow) |
Returns the EQ window. | |
HRESULT | LibrarySource ([out, retval] IITSource **iLibrarySource) |
Returns the source that represents the main library. | |
HRESULT | LibraryPlaylist ([out, retval] IITLibraryPlaylist **iLibraryPlaylist) |
Returns the main library playlist in the main library source. | |
HRESULT | CurrentTrack ([out, retval] IITTrack **iTrack) |
Returns the currently targeted track. | |
HRESULT | CurrentPlaylist ([out, retval] IITPlaylist **iPlaylist) |
Returns the playlist containing the currently targeted track. | |
HRESULT | SelectedTracks ([out, retval] IITTrackCollection **iTrackCollection) |
Returns a collection containing the currently selected track or tracks. | |
HRESULT | Version ([out, retval] BSTR *version) |
Returns the version of the iTunes application. | |
HRESULT | AppCommandMessageProcessingEnabled ([out, retval] VARIANT_BOOL *isEnabled) |
Returns true if iTunes will process APPCOMMAND Windows messages. | |
HRESULT | AppCommandMessageProcessingEnabled ([in] VARIANT_BOOL shouldEnable) |
Controls whether iTunes should process APPCOMMAND Windows messages. | |
HRESULT | ForceToForegroundOnDialog ([out, retval] VARIANT_BOOL *forceToForegroundOnDialog) |
Returns true if iTunes will force itself to be the foreground application when it displays a dialog. | |
HRESULT | ForceToForegroundOnDialog ([in] VARIANT_BOOL forceToForegroundOnDialog) |
Controls whether iTunes will force itself to be the foreground application when it displays a dialog. | |
HRESULT | CanSetShuffle ([in] VARIANT *iPlaylist,[out, retval] VARIANT_BOOL *canSetShuffle) |
Returns true if the IITPlaylist::Shuffle property is writable for the specified playlist. | |
HRESULT | CanSetSongRepeat ([in] VARIANT *iPlaylist,[out, retval] VARIANT_BOOL *canSetSongRepeat) |
Returns true if the IITPlaylist::SongRepeat property is writable for the specified playlist. | |
HRESULT | ConvertOperationStatus ([out, retval] IITConvertOperationStatus **iStatus) |
Returns an IITConvertOperationStatus object if there is currently a conversion in progress. | |
HRESULT | SoundVolumeControlEnabled ([out, retval] VARIANT_BOOL *isEnabled) |
Returns true if the sound volume control is enabled. | |
HRESULT | LibraryXMLPath ([out, retval] BSTR *filePath) |
Returns the full path to the current iTunes library XML file. The default file is "iTunes Music Library.xml" inside the "iTunes" folder in the user's "My Music" folder. | |
HRESULT | ITObjectPersistentIDHigh ([in] VARIANT *iObject,[out, retval] long *highID) |
Returns the high 32 bits of the persistent ID of the specified IITObject. See the documentation on IITObject for more information on persistent IDs. | |
HRESULT | ITObjectPersistentIDLow ([in] VARIANT *iObject,[out, retval] long *lowID) |
Returns the low 32 bits of the persistent ID of the specified IITObject. See the documentation on IITObject for more information on persistent IDs. |
|
Controls whether iTunes should process APPCOMMAND Windows messages. If true, iTunes will process Windows APPCOMMAND messages such as APPCOMMAND_MEDIA_PLAY, APPCOMMAND_MEDIA_PAUSE, APPCOMMAND_MEDIA_NEXTTRACK, etc. Typically, these messages are generated by special keys on multimedia keyboards.
|
|
Returns true if iTunes will process APPCOMMAND Windows messages. If true, iTunes will process Windows APPCOMMAND messages such as APPCOMMAND_MEDIA_PLAY, APPCOMMAND_MEDIA_PAUSE, APPCOMMAND_MEDIA_NEXTTRACK, etc. Typically, these messages are generated by special keys on multimedia keyboards.
|
|
Reposition to the beginning of the current track or go to the previous track if already at start of current track.
|
|
Returns the main iTunes browser window.
|
|
Returns true if the IITPlaylist::Shuffle property is writable for the specified playlist.
|
|
Returns true if the IITPlaylist::SongRepeat property is writable for the specified playlist.
|
|
Returns true if this version of the iTunes type library is compatible with the specified version. The current major version is kITTypeLibrary_MajorVersion. The current minor version is kITTypeLibrary_MinorVersion. iTunes 4.5 included version 1.0 of the iTunes type library. iTunes 4.6 included version 1.1 of the iTunes type library.
|
|
Start converting the specified file or folder. The file or files will added to the main library after conversion. For a file on an audio CD, this is equivalent to importing the song. Use IiTunes::CurrentEncoder() to set the current encoder before converting.
|
|
Start converting the specified file or folder. The file or files will added to the main library after conversion. For a file on an audio CD, this is equivalent to importing the song. Use IiTunes::CurrentEncoder() to set the current encoder before converting.
|
|
Start converting the specified files and/or folders. The files will added to the main library after conversion. For files on an audio CD, this is equivalent to importing the songs. Use IiTunes::CurrentEncoder() to set the current encoder before converting.
|
|
Start converting the specified files and/or folders. The files will added to the main library after conversion. For files on an audio CD, this is equivalent to importing the songs. Use IiTunes::CurrentEncoder() to set the current encoder before converting.
|
|
Returns an IITConvertOperationStatus object if there is currently a conversion in progress.
|
|
Start converting the specified track. For a track in an audio CD playlist, this is equivalent to importing the song. Use IiTunes::CurrentEncoder() to set the current encoder before converting.
|
|
Start converting the specified track. For a track in an audio CD playlist, this is equivalent to importing the song. Use IiTunes::CurrentEncoder() to set the current encoder before converting.
|
|
Start converting the specified tracks. For a tracks in an audio CD playlist, this is equivalent to importing the songs. Use IiTunes::CurrentEncoder() to set the current encoder before converting.
|
|
Start converting the specified tracks. For a tracks in an audio CD playlist, this is equivalent to importing the songs. Use IiTunes::CurrentEncoder() to set the current encoder before converting.
|
|
Creates a new EQ preset. The EQ preset will be created "flat", i.e. the preamp and all band levels will be set to 0. EQ preset names cannot start with leading spaces. If you specify a name that starts with leading spaces they will be stripped out. If eqPresetName is NULL or empty, the EQ preset will be created with a default name.
|
|
Creates a new folder in the main library. If folderName is NULL or empty, the folder will be created with a default name.
|
|
Creates a new folder in an existing source. You may not be able to create a folder in every source. For example, you cannot create a folder in an audio CD source, or in an iPod source if it is in auto update mode. If folderName is NULL or empty, the folder will be created with a default name.
|
|
Creates a new playlist in the main library. If playlistName is NULL or empty, the playlist will be created with a default name.
|
|
Creates a new playlist in an existing source. You may not be able to create a playlist in every source. For example, you cannot create a playlist in an audio CD source, or in an iPod source if it is in auto update mode. If playlistName is NULL or empty, the playlist will be created with a default name.
|
|
Sets the current encoder (AAC, MP3, AIFF, WAV, etc.).
|
|
Returns the currently selected encoder (AAC, MP3, AIFF, WAV, etc.).
|
|
Sets the current EQ preset.
|
|
Returns the currently selected EQ preset.
|
|
Returns the playlist containing the currently targeted track.
|
|
Returns the name of the current song in the playing stream (provided by streaming server).
|
|
Returns the URL of the playing stream or streaming web site (provided by streaming server).
|
|
Returns the currently targeted track.
|
|
Sets the current visual plug-in.
|
|
Returns the currently selected visual plug-in.
|
|
Returns a collection of encoders.
|
|
Set whether the equalizer should be enabled.
|
|
Returns true if the equalizer is enabled.
|
|
Returns a collection of EQ presets.
|
|
Returns the EQ window.
|
|
Skip forward in a playing track.
|
|
Controls whether iTunes will force itself to be the foreground application when it displays a dialog. This property is false by default, since typically a user will not want iTunes to come to the foreground if it isn't already the foreground application. For example, a user may be listening to a radio stream in the background, and a progress dialog could be displayed if the stream needs to be rebuffered. Since this dialog will go away when the rebuffering is complete, there is no reason for iTunes be forced to the foreground.
|
|
Returns true if iTunes will force itself to be the foreground application when it displays a dialog. This property is false by default, since typically a user will not want iTunes to come to the foreground if it isn't already the foreground application. For example, a user may be listening to a radio stream in the background, and a progress dialog could be displayed if the stream needs to be rebuffered. Since this dialog will go away when the rebuffering is complete, there is no reason for iTunes be forced to the foreground.
|
|
Set whether visuals should be displayed using the entire screen.
|
|
Returns true if the visuals are displayed using the entire screen.
|
|
Returns an IITObject corresponding to the specified IDs. The object may be a source, playlist, or track.
|
|
Returns the high and low 32 bits of the persistent ID of the specified IITObject. See the documentation on IITObject for more information on persistent IDs. This method is not usable from scripting clients, since it returns multiple output parameters. Scripting clients must use IiTunes::ITObjectPersistentIDHigh() and IiTunes::ITObjectPersistentIDLow() properties instead. The object may be a source, playlist, or track.
|
|
Retrieves the current state of the player buttons in the window containing the currently targeted track. If there is no currently targeted track, returns the current state of the player buttons in the main browser window. This method is not usable from scripting clients, since it returns multiple output parameters.
|
|
Go to the iTunes Store home page. If the iTunes Store is already open in a separate window, the home page will be displayed there. Otherwise, it will be displayed in the main browser window. The window containing the store will be brought to the foreground.
|
|
Returns the high 32 bits of the persistent ID of the specified IITObject. See the documentation on IITObject for more information on persistent IDs. This property and IiTunes::ITObjectPersistentIDLow() are meant to be used from scripting clients, since they can't handle multiple output parameters. If you don't need an automation-compatible interface, use the IiTunes::GetITObjectPersistentIDs() method instead. The object may be a source, playlist, or track.
|
|
Returns the low 32 bits of the persistent ID of the specified IITObject. See the documentation on IITObject for more information on persistent IDs. This property and IiTunes::ITObjectPersistentIDHigh() are meant to be used from scripting clients, since they can't handle multiple output parameters. If you don't need an automation-compatible interface, use the IiTunes::GetITObjectPersistentIDs() method instead. The object may be a source, playlist, or track.
|
|
Returns the main library playlist in the main library source.
|
|
Returns the source that represents the main library. You can also find the main library source by iterating over IiTunes::Sources() and looking for an IITSource of kind ITSourceKindLibrary.
|
|
Returns the full path to the current iTunes library XML file. The default file is "iTunes Music Library.xml" inside the "iTunes" folder in the user's "My Music" folder.
|
|
Sets sound output mute state.
|
|
Returns true if the sound output is muted.
|
|
Advance to the next track in the current playlist.
|
|
Open the specified iTunes Store or streaming audio URL. If the specified URL is an iTunes Store URL, the window containing the store will be brought to the foreground. If the iTunes Store is already open in a separate window, the home page will be displayed there. Otherwise, it will be displayed in the main browser window.
|
|
Pause playback.
|
|
Play the currently targeted track.
|
|
Simulate a click on a player control button in the window containing the currently targeted track. If there is no currently targeted track, simulates a click on a player control button in the main browser window. You can specify modifier keys to get the special behaviors built into iTunes (e.g. shift-control-next button to go to the next chapter in an audio book).
|
|
Sets the player's position within the currently playing track in seconds. If playerPos specifies a position before the beginning of the track, the position will be set to the beginning. If playerPos specifies a position after the end of the track, the position will be set to the end.
|
|
Returns the player's position within the currently playing track in seconds.
|
|
Returns the current player state.
|
|
Play the specified file path, adding it to the library if not already present.
|
|
Toggle the playing/paused state of the current track.
|
|
Return to the previous track in the current playlist.
|
|
Exits the iTunes application.
|
|
Disable fast forward/rewind and resume playback, if playing.
|
|
Skip backwards in a playing track.
|
|
Returns a collection containing the currently selected track or tracks. The frontmost visible window in iTunes must be a browser or playlist window. If there is no frontmost visible window (e.g. iTunes is minimized to the system tray), the main browser window is used.
|
|
Sets the sound output volume (0 = minimum, 100 = maximum). Note that volume will be pinned to the range 0 through 100.
|
|
Returns the sound output volume (0 = minimum, 100 = maximum).
|
|
Returns true if the sound volume control is enabled.
|
|
Returns a collection of music sources (music library, CD, device, etc.).
|
|
Stop playback.
|
|
Subscribes to the specified podcast feed URL. Any "unsafe" characters in the URL should already be converted into their corresponding escape sequences, iTunes will not do this.
|
|
Update the contents of the iPod.
|
|
Updates all podcast feeds. This is equivalent to the user pressing the Update button when Podcasts is selected in the Source list.
|
|
Returns the version of the iTunes application.
|
|
Returns a collection of visual plug-ins.
|
|
Set whether visuals should be displayed.
|
|
Returns true if visuals are currently being displayed.
|
|
Sets the size of the displayed visual.
|
|
Returns the size of the displayed visual.
|
|
Returns a collection of visual plug-ins.
|