ActiveX Interface
Note: The following information is only useful if you are a Windows developer and you want to access Turbo Play functions from other applications or HTML or a Scripting Language, such as JavaScript, VBScript or even Flash ActionScript.
The ActiveX interface is a way for other applications to manipulate Turbo Play. All functions describes in Scripts can be used from an external application as well.
Turbo Play uses standard registry convensions to register itself as a "Local Server" COM object. Use prog ID "TurboPlay.Application" to query for the CLSID. After that, creating a standard IDispatch with CoCreateInstance allows you to use any Turbo Play script functions. In case you ever want to control Turbo Play from an external application, a HTML page or a Scripting Language such as JavaScript, this is for you.
The following C++ sample shows how an external application can use Turbo Play to open a project, save it and then quit:
#include <windows.h> #include <comdef.h>
int main()
{
OleInitialize(0); // Initialize COM
CLSID g;
CLSIDFromProgID(L"TurboPlay.Application", &g); // Obtain Turbo Play CLSID
IDispatch* u = 0;
HRESULT HR = CoCreateInstance(g,0,CLSCTX_LOCAL_SERVER,__uuidof(IDispatch),(void**)&u); // Create the IDispatch
if (!u)
return 0;
// Sample on how to get the Type Information. Turbo Play provides Type Information for all it's functions in case you want to query the correct parameters to pass. ITypeInfo* ty = 0; u->GetTypeInfo(0,0,&ty); if (ty) ty->Release();
// Get Dispatch IDs for 3 functions
TCHAR* n[] = {L"Open",L"Save",L"Quit"};
DISPID di[3] = {0};
HR = u->GetIDsOfNames(IID_NULL,n,3,0,di);
// Open file
_bstr_t bf(L"g:\\vst\\all\\1.tp");
VARIANTARG va;
va.vt = VT_BSTR;
va.bstrVal = bf.GetBSTR();
DISPPARAMS p = {0};
p.cArgs = 1;
p.rgvarg = &va;
u->Invoke(di[0],IID_NULL,0,DISPATCH_METHOD,&p,0,0,0);
// Save file va.vt = VT_BSTR; va.bstrVal = bf.GetBSTR(); p.cArgs = 1; p.rgvarg = &va; u->Invoke(di[1],IID_NULL,0,DISPATCH_METHOD,&p,0,0,0);
// Exit Turbo Play u->Invoke(di[2],IID_NULL,0,DISPATCH_METHOD,&p,0,0,0);
// Release the Interface u->Release(); u = 0; return 0; }