Hello,
I'm trying to query the artist and title of the current song playing. I've successfully got a plugin working, but the functions to retreive the info do not work.
The examples I've seen use a TVdjQueryResult structure, but this seems to be deprecated. I've tried this, but it does not seem to work:
char author[256];
char title[256];
char qRes[256];
HRESULT hr = GetStringInfo ("get loaded_song 'author'", &qRes[0], sizeof (qRes));
if (hr == S_OK) {
MultiByteToWideChar( CP_UTF8, 0, qRes, strlen(qRes) + 1, artist, sizeof (artist));
}
hr = GetStringInfo ("get loaded_song 'title'", &qRes[0], sizeof (qRes));
if (hr == S_OK) {
MultiByteToWideChar( CP_UTF8, 0, qRes, strlen(qRes) + 1, title, sizeof (title));
}
Apparently I'm not doing it right. How should it be done?
Thanks,
Peter
I'm trying to query the artist and title of the current song playing. I've successfully got a plugin working, but the functions to retreive the info do not work.
The examples I've seen use a TVdjQueryResult structure, but this seems to be deprecated. I've tried this, but it does not seem to work:
char author[256];
char title[256];
char qRes[256];
HRESULT hr = GetStringInfo ("get loaded_song 'author'", &qRes[0], sizeof (qRes));
if (hr == S_OK) {
MultiByteToWideChar( CP_UTF8, 0, qRes, strlen(qRes) + 1, artist, sizeof (artist));
}
hr = GetStringInfo ("get loaded_song 'title'", &qRes[0], sizeof (qRes));
if (hr == S_OK) {
MultiByteToWideChar( CP_UTF8, 0, qRes, strlen(qRes) + 1, title, sizeof (title));
}
Apparently I'm not doing it right. How should it be done?
Thanks,
Peter
Inviato Thu 27 Aug 20 @ 4:50 pm
Never mind. GetStringInfo is working just fine. The problem was MultiByteToWideChar. I don't need to use that at all. The text returned by GetStringInfo is already UTF-8 which is what I need for my application. All is good!
Inviato Thu 27 Aug 20 @ 5:45 pm