Hello.
I'm currently trying to make a neat plugin which will get the song played from winamp, and change the avatar with the cover winamp is playing (using the folder.jpg files in each album's folder)
So the method i'm trying is the following :
- make a C++ DLL which, when called, will return the string containing the currently played song's filename
- call it by Interop.Call2, do some stuff and change the avatar
Looking in the plus scripting help, i found that the string returned must be a "bstr". I have a C-style string (char*) containing the file name (although it's not unicode, i wonder if it will prevent it from working ... well, will see later), I want to return it as a bstring.
I tried the following :
OLECHAR title2[1024];
for(int i = 0;i<1024;i++) title2[i] = title[i];
return SysAllocString(title2);
, as advised in the help, but it fails to compile (" [Linker error] undefined reference to `SysAllocString@4' ")
I also tried return title2; It compiles, but i don't know if it works :/
Another thing that bothers me is : how to make my function "call2-visible" ?
My code is :
__declspec(dllexport) __stdcall BSTR GetTitle();
__stdcall BSTR GetTitle()
{
//do stuff, return the BSTR
}
BOOL APIENTRY DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved)
{
return TRUE;
}
My script is :
function OnEvent_ChatWndSendMessage(ChatWnd,Message )
{
return Interop.Call2("GetFileName.dll","GetTitle");
}
and it doesn't work :/
I have really little experience in writing C++ DLL, so excuse me if my questions seem stupid
Thanks in advance
Smeuuh