utils.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #ifndef __UTILS_H
  2. #define __UTILS_H
  3. #include <vector>
  4. #include <string>
  5. #ifdef WIN32
  6. #define snprintf _snprintf
  7. #define snwprintf _snwprintf
  8. #endif
  9. extern char IniName[MAX_PATH],
  10. IniEncName[MAX_PATH],
  11. IniDir[MAX_PATH];
  12. wchar_t* GetSharedDirectoryW(HWND winamp);
  13. wchar_t* GetPluginDirectoryW(HWND winamp);
  14. char* GetIniDirectory(HWND winamp);
  15. char* GetSCIniFile(HWND winamp);
  16. void GetDefaultNextTracksLogFile(HWND winamp, int bufferLen, wchar_t* buffer, int index);
  17. #define NUM_OUTPUTS 5
  18. extern HANDLE logFiles[NUM_OUTPUTS];
  19. wchar_t* GetSCLogFile(HWND winamp, int bufferLen, wchar_t* logFile, int index);
  20. char* CreateLogFileMessage(char* buffer, wchar_t* message, int* len);
  21. void StartLogging(int index, int clearOnStart);
  22. void StopLogging(int index);
  23. void StartNextTracks(int index, wchar_t* file);
  24. void WriteNextTracks(int index, HWND winamp, std::vector<int> nextListIdx, std::vector<std::wstring> nextList, bool xml);
  25. void StopNextTracks(int index);
  26. void StartSaveEncoded(int index, wchar_t* file);
  27. void WriteSaveEncoded(int index, LPCVOID buffer, int bufferLen);
  28. void StopSaveEncoded(int index);
  29. INT_PTR LocalisedDialogBox(HINSTANCE hDllInstance, UINT dialog_id, HWND hWndParent, DLGPROC lpDialogFunc);
  30. HWND LocalisedCreateDialog(HINSTANCE instance, UINT dialog_id, HWND hWndParent, DLGPROC DlgProc, LPARAM user_id);
  31. char* LocalisedStringA(UINT uID, char *str, size_t maxlen);
  32. wchar_t* LocalisedString(UINT uID, wchar_t *str, size_t maxlen);
  33. UINT GetWinampVersion(HWND winamp);
  34. bool IsVistaUp();
  35. HINSTANCE GetMyInstance();
  36. HWND GetWinampHWND(HWND winamp);
  37. extern int isthemethere;
  38. BOOL link_handledraw(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  39. void link_startsubclass(HWND hwndDlg, UINT id);
  40. BOOL DirectMouseWheel_ProcessDialogMessage(HWND hwnd, unsigned int uMsg, WPARAM wParam, LPARAM lParam);
  41. char* escapeXML(const char* s);
  42. char* ConvertToUTF8Escaped(const wchar_t *str);
  43. char* ConvertToUTF8(const wchar_t *str);
  44. int ConvertFromUTF8(const char *src, wchar_t *dest, int destlen);
  45. // reads a unicode string stored in utf8 from an ini file
  46. DWORD GetPrivateProfileStringUTF8(LPCSTR lpAppName, LPCSTR lpKeyName, LPCSTR lpDefault, LPWSTR lpReturnedString, DWORD nSize, LPCSTR lpFileName);
  47. void WritePrivateProfileInt(LPCSTR lpKeyName, int value, LPCSTR lpAppName, LPCSTR lpFileName);
  48. void ShowWindowDlgItem(HWND hDlg, int nIDDlgItem, int nCmdShow);
  49. void EnableWindowDlgItem(HWND hDlg, int nIDDlgItem, BOOL bEnable);
  50. bool CompareVersions(char *verStr);
  51. #endif