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

This forum is for questions / discussions regarding development of addons / tweaks for MediaMonkey.

Moderator: Gurus

ebfe

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

Post by ebfe » Tue Mar 03, 2009 7:02 pm

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


dplummer
Posts: 9
Joined: Sat Dec 20, 2008 12:55 pm

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

Post by dplummer » Thu Jun 14, 2018 12:50 pm

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
Best Regards
Dave Plummer
Norwich UK
MMW user since 2008, MMA user since release

Post Reply