// test del.cpp : Defines the entry point for the application. // #include "stdafx.h" #include #include #include "dMCScripting.h" #include "dMCScripting.c" class BString { public: BString (void) { Str = SysAllocString(NULL); } ~BString () { SysFreeString(Str); } BSTR String (void) { return(Str); } BSTR *StrAddress (void) { return(&Str); } void SetString (wchar_t *ToSet) { SysReAllocString(&Str, ToSet); } private: BSTR Str; }; int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { CoInitialize(NULL); IConverter *m_Converter = NULL; if (CoCreateInstance(CLSID_Converter, NULL, CLSCTX_INPROC_SERVER, IID_IConverter, (void * *)&m_Converter) != S_OK) return(0); // Get list of compression codecs int i; for (i = 0; ; i++) { BString Codec; m_Converter->get_GetCompressions(i, Codec.StrAddress()); if (Codec.String()[0] == NULL) break; MessageBoxW(0, Codec.String(), L"Codecs", 0); } // Do one conversion m_Converter->Convert(L"z:\\abc.ape", L"z:\\new file.mp3", L"mp3 (Lame)", L"-b=128", L""); // Read All IDTags for (i = 0; ; i++) { BString Element, TagVal; m_Converter->ReadIDTag(L"z:\\abc.ape", i, Element.StrAddress(), TagVal.StrAddress()); if (Element.String()[0] == NULL) break; MessageBoxW(0, TagVal.String(), Element.String(), 0); } // Write an ID Tag m_Converter->WriteIDTag(L"z:\\abc.ape", L"element2", L"value2"); // Show compression settings page BString CompressionCLI; CompressionCLI.SetString(L"-b=128"); m_Converter->get_ShowSettings(L"mp3 (Lame)", /* in */ CompressionCLI.String(), /* out */ CompressionCLI.StrAddress()); MessageBoxW(0, CompressionCLI.String(), L"Returned Compression CLI: ", 0); // Read audio properties of a file BString AudioProps; m_Converter->get_AudioProperties(L"z:\\abc.ape", AudioProps.StrAddress()); MessageBoxW(0, AudioProps.String(), L"Audio Properties: ", 0); CoUninitialize(); return 0; }