main.cpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #include "main.h"
  2. #include "../Winamp/wa_ipc.h"
  3. #include "resource.h"
  4. #include "api.h"
  5. #include "../nu/AutoWide.h"
  6. #include "../nu/AutoChar.h"
  7. #include <strsafe.h>
  8. #include "..\..\General\gen_ml\menu.h"
  9. #include "..\..\General\gen_ml\ml_ipc_0313.h"
  10. #define PLUGIN_VERSION L"1.1"
  11. int Init();
  12. void Quit();
  13. UINT_PTR xmlex_treeItem = 0;
  14. api_service *serviceManager = 0;
  15. EXTERN_C winampMediaLibraryPlugin plugin =
  16. {
  17. MLHDR_VER,
  18. "Nullsoft XML Reader",
  19. Init,
  20. Quit,
  21. xmlex_pluginMessageProc,
  22. 0,
  23. 0,
  24. 0,
  25. };
  26. int Init()
  27. {
  28. //starting point for wasabi, where services are shared
  29. WASABI_API_SVC = (api_service *)SendMessage(plugin.hwndWinampParent, WM_WA_IPC, 0, IPC_GET_API_SERVICE);
  30. // waServiceFactory *sf = plugin.service->service_getServiceByGuid(languageApiGUID);
  31. // if (sf) WASABI_API_LNG = reinterpret_cast<api_language*>(sf->getInterface());
  32. // wasabi based services for localisation support
  33. // api_language* WASABI_API_LNG = 0;
  34. // HINSTANCE WASABI_API_LNG_HINST = 0, WASABI_API_ORIG_HINST = 0;
  35. // need to have this initialised before we try to do anything with localisation features
  36. // WASABI_API_START_LANG(plugin.hDllInstance,MlImpexLangGUID);
  37. // static wchar_t szDescription[256];
  38. // StringCchPrintf(szDescription, ARRAYSIZE(szDescription),
  39. // WASABI_API_LNGSTRINGW(IDS_NULLSOFT_XMLEX), PLUGIN_VERSION);
  40. // plugin.description = (char*)szDescription;
  41. //set up tree item, gen_ml will call xmlex_pluginMessageProc if/when the treeview item gets selected
  42. MLTREEITEMW newTree;
  43. newTree.size = sizeof(MLTREEITEMW);
  44. newTree.parentId = 0;
  45. newTree.title = L"XML Example";
  46. newTree.hasChildren = 0;
  47. newTree.id = 0;
  48. SendMessage(plugin.hwndLibraryParent, WM_ML_IPC, (WPARAM) &newTree, ML_IPC_TREEITEM_ADDW);
  49. xmlex_treeItem = newTree.id;
  50. return 0; // 0 for success. returning non-zero will cause gen_ml to abort loading your plugin
  51. }
  52. void Quit()
  53. {
  54. }
  55. extern "C" __declspec(dllexport) winampMediaLibraryPlugin *winampGetMediaLibraryPlugin()
  56. {
  57. return &plugin;
  58. }