util.cpp 918 B

123456789101112131415161718192021222324252627282930313233343536
  1. #include "main.h"
  2. #include "../winamp/wa_ipc.h"
  3. int GetFileInfo(const wchar_t *filename, wchar_t *metadata, wchar_t *dest, int len)
  4. {
  5. dest[0]=0;
  6. extendedFileInfoStructW efis=
  7. {
  8. filename,
  9. metadata,
  10. dest,
  11. (size_t)len,
  12. };
  13. int r = SendMessage(plugin.hwndWinampParent,WM_WA_IPC,(WPARAM)&efis,IPC_GET_EXTENDED_FILE_INFOW); //will return 1 if wa2 supports this IPC call
  14. return r;
  15. }
  16. int updateFileInfo(const wchar_t *filename, wchar_t *metadata, wchar_t *data)
  17. {
  18. extendedFileInfoStructW efis =
  19. {
  20. filename,
  21. metadata,
  22. data ? data : L"",
  23. data ? wcslen(data) : 0,
  24. };
  25. return SendMessage(plugin.hwndWinampParent, WM_WA_IPC, (WPARAM)&efis, IPC_SET_EXTENDED_FILE_INFOW);
  26. }
  27. void WriteFileInfo(const wchar_t *filename)
  28. {
  29. SendMessage(plugin.hwndWinampParent, WM_WA_IPC, 0, IPC_WRITE_EXTENDED_FILE_INFO);
  30. SendMessage(plugin.hwndWinampParent, WM_WA_IPC, (WPARAM)filename, IPC_FILE_TAG_MAY_HAVE_UPDATEDW);
  31. }