Page 1 of 1

QuerySongs in C++, how to use the IDispatch result?

Posted: Tue Mar 03, 2009 7:02 pm
by ebfe
So I got up to Querying the DB with QuerySong, which work, but after that I don't know how to use the IDispatch returned by QuerySong,

I have tried to cast it to a SongIterator which is what it should return, but using it cause access violation.

Code:

Code: Select all

			
ISDBSongIterator* AllSongs = NULL;

IDispatch *iter;
iSDBApp->get_Database(&iSDBDatabase);
hRes = iSDBDatabase->QuerySongs(L"ID > 0",&iter);

if(hRes == S_OK)
{
	VARIANT_BOOL eof;
	hRes = ((ISDBSongIterator*)AllSongs)->get_EOF(&eof); //FAIL
}

if(hRes == S_OK)	
	ISDBSongData *song;
	hRes = ((ISDBSongIterator*)AllSongs)->get_Item(&song); //FAIL
}	
So i guess I cannot just cast IDispatch to ISDBSongIterator* as I did..

Can anyone help?

Btw, I am making a C++ Bridge to Sync iTunes & MediaMonkey Database

Re: QuerySongs in C++, how to use the IDispatch result?

Posted: Tue Mar 10, 2009 4:20 pm
by ebfe
bump?

Re: QuerySongs in C++, how to use the IDispatch result?

Posted: Thu Jun 14, 2018 12:50 pm
by dplummer
I know this question is from way in the past but did you ever get to a solution?

I am in exactly the same place and having difficulty believing that getting a SongIterator object from the IDispatch result requires as much code as the MS manual pages seem to imply.

Please do share any solution or wisdom that you found

Regards

Dave