1
0

ml.h 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915
  1. /*
  2. ** Copyright (C) 2003-2014 Winamp SA
  3. **
  4. ** This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held
  5. ** liable for any damages arising from the use of this software.
  6. **
  7. ** Permission is granted to anyone to use this software for any purpose, including commercial applications, and to
  8. ** alter it and redistribute it freely, subject to the following restrictions:
  9. **
  10. ** 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software.
  11. ** If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  12. **
  13. ** 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
  14. **
  15. ** 3. This notice may not be removed or altered from any source distribution.
  16. **
  17. */
  18. #ifndef _ML_H_
  19. #define _ML_H_
  20. #define MLHDR_VER 0x17 // used from Winamp v5.66
  21. #define MLHDR_VER_U 0x16 // used from Winamp v5.64 to v5.65 (is loaded by v5.66+)
  22. #define MLHDR_VER_OLD 0x15 // used up to Winamp v5.63 (is loaded by v5.64+)
  23. #include <windows.h>
  24. #include <commctrl.h>
  25. #include <stddef.h>
  26. #include <api/service/api_service.h>
  27. typedef struct
  28. {
  29. int version; // changed 5.64+ - MLHDR_VER will now require a unicode (wchar_t*) description and only work correctly on 5.64+
  30. // MLHDR_VER_OLD will still be loaded but will use the original (char*) description as before
  31. // note: we are using the fact that sizeof(char*) == sizeof(wchar_t*) to be able to allow this
  32. // so when using MLHDR_VER = 0x16 or higher then you will need to cast description to be
  33. // a (char*) to be able to set it
  34. const char *description;
  35. int (__cdecl *init)(); // return 0 on success, non-zero for failure (quit WON'T be called)
  36. void (__cdecl *quit)();
  37. // return NONZERO if you accept this message as yours, otherwise 0 to pass it to other plugins
  38. INT_PTR (__cdecl *MessageProc)(int message_type, INT_PTR param1, INT_PTR param2, INT_PTR param3);
  39. // Note: INT_PTR becomes 64bit on 64bit compiles...
  40. // if you don't like windows types or caps, you can #include <stddef.h> and use intptr_t
  41. // all the following data is filled in by the library
  42. HWND hwndWinampParent;
  43. HWND hwndLibraryParent; // send this any of the WM_ML_IPC messages
  44. HINSTANCE hDllInstance;
  45. // filled in by Winamp (added 5.66+ to replace need to call IPC_GET_API_SERVICE on loading)
  46. #ifdef __cplusplus
  47. api_service *service;
  48. #else
  49. void * service;
  50. #endif
  51. } winampMediaLibraryPlugin;
  52. // return values from the init(..) which determines if Winamp will continue loading
  53. // and handling the plugin or if it will disregard the load attempt. If ML_INIT_FAILURE
  54. // is returned then the plugin will be listed as [NOT LOADED] on the plug-in prefs page.
  55. #define ML_INIT_SUCCESS 0
  56. #define ML_INIT_FAILURE 1
  57. // These are the return values to be used with the uninstall plugin export function:
  58. // __declspec(dllexport) int __cdecl winampUninstallPlugin(HINSTANCE hDllInst, HWND hwndDlg, int param)
  59. // which determines if Winamp can uninstall the plugin immediately or on winamp restart.
  60. // If this is not exported then Winamp will assume an uninstall with reboot is the only way.
  61. #define ML_PLUGIN_UNINSTALL_NOW 0x1
  62. #define ML_PLUGIN_UNINSTALL_REBOOT 0x0
  63. //
  64. // Uninstall support was added from 5.0+ and uninstall now support from 5.5+ though note
  65. // that it is down to you to ensure that if uninstall now is returned that it will not
  66. // cause a crash i.e. don't use if you've been subclassing the main or library windows.
  67. //
  68. // The HWND passed in the calling of winampUninstallPlugin(..) is the preference page HWND.
  69. //
  70. // For a Media Library plugin to be correctly detected by Winamp you need to ensure that
  71. // the exported winampMediaLibraryPlugin(..) is exported as an undecorated function
  72. // e.g.
  73. // #ifdef __cplusplus
  74. // extern "C" {
  75. // #endif
  76. // __declspec(dllexport) winampMediaLibraryPlugin * __cdecl winampGetMediaLibraryPlugin(){ return &plugin; }
  77. // #ifdef __cplusplus
  78. // }
  79. // #endif
  80. //
  81. // messages your plugin may receive on MessageProc()
  82. #define ML_MSG_TREE_BEGIN 0x100
  83. #define ML_MSG_TREE_ONCREATEVIEW 0x100 // param1 = param of tree item, param2 is HWND of parent. return HWND if it is us
  84. #define ML_MSG_TREE_ONCLICK 0x101 // param1 = param of tree item, param2 = action type (below), param3 = HWND of main window
  85. #define ML_ACTION_RCLICK 0 // return value should be nonzero if ours
  86. #define ML_ACTION_DBLCLICK 1
  87. #define ML_ACTION_ENTER 2
  88. #define ML_ACTION_LCLICK 3
  89. #define ML_MSG_TREE_ONDROPTARGET 0x102 // param1 = param of tree item, param2 = type of drop (ML_TYPE_*), param3 = pointer to data (or NULL if querying).
  90. // return -1 if not allowed, 1 if allowed, or 0 if not our tree item
  91. #define ML_MSG_TREE_ONDRAG 0x103 // param1 = param of tree item, param2 = POINT * to the mouse position, and param3 = (int *) to the type
  92. // set *(int*)param3 to the ML_TYPE you want and return 1, if you support drag&drop, or -1 to prevent d&d.
  93. #define ML_MSG_TREE_ONDROP 0x104 // param1 = param of tree item, param2 = POINT * to the mouse position
  94. // if you support dropping, send the appropriate ML_IPC_HANDLEDROP using SendMessageW() and return 1, otherwise return -1.
  95. #define ML_MSG_TREE_ONKEYDOWN 0x105 // Send when key pressed
  96. // param1 = param of tree item;
  97. // param2 = pointer to NMTVKEYDOWN
  98. // param3 = tree hwnd
  99. // return 0 if it's not yours, 1 if it is
  100. #define ML_MSG_TREE_END 0x1FF // end of tree specific messages
  101. #define ML_MSG_ONSENDTOBUILD 0x300 // you get sent this when the sendto menu gets built
  102. // param1 = type of source, param2 param to pass as context to ML_IPC_ADDTOSENDTO
  103. // be sure to return 0 to allow other plugins to add their context menus
  104. // if your sendto item is selected, you will get this with your param3 == your user32 (preferably some
  105. // unique identifier (like your plugin message proc). See ML_IPC_ADDTOSENDTO
  106. #define ML_MSG_ONSENDTOSELECT 0x301
  107. // param1 = type of source, param2 = data, param3 = user32
  108. // param1 = write type - added 5.7
  109. // this relates to IPC_WRITECONFIG (see wa_ipc.h) for values sent via 'param1'
  110. #define ML_MSG_WRITE_CONFIG 0x397
  111. // param1 = wchar_t* of the file filepath of the file when playback begins - added 5.7
  112. // this relates to IPC_PLAYING_FILEW (see wa_ipc.h) without the need to subclass Winamp
  113. #define ML_MSG_PLAYING_FILE 0x398
  114. // return TRUE to block the closing of Winamp (relates to IPC_HOOK_OKTOQUIT) - added 5.64+
  115. #define ML_MSG_NOTOKTOQUIT 0x399
  116. // return TRUE and do a config dialog using param1 as a HWND parent for this one
  117. #define ML_MSG_CONFIG 0x400
  118. // return TRUE to allow the plug-in config button to be disabled as applicable
  119. #define ML_MSG_NO_CONFIG 0x401
  120. // added from 5.64+ (internal usage, do not re-use this message range unless allowed)
  121. #define ML_MSG_CLOUD_MIN 0x402
  122. #define ML_MSG_CLOUD_MAX 0x410
  123. // added from 5.66+ (used for some easier plug-in hooking of the views
  124. #define ML_MSG_VIEW_BUTTON_HOOK 0x420 // param1 = hwndDlg, param2 = MAKELONG(button_id_to_use, button_id_to_follow), param3 = plug-in id e.g. "ml_history". return text to show on the button
  125. #define ML_MSG_VIEW_BUTTON_HOOK_IN_USE 0x421 // param1 = current 'play' / 'enqueue' mode
  126. #define ML_MSG_VIEW_PLAY_ENQUEUE_CHANGE 0x422 // param1 = new state of 'play' / 'enqueue' mode, param2 = new state of 'button grouping mode'
  127. // these can be also read from gen_ml.ini and the [gen_ml_config] using 'enqueuedef' and 'groupbtn' respectively
  128. // note: you can use IPC_GETMLINIFILEW from wa_ipc.h to get the gen_ml.ini path
  129. typedef struct
  130. {
  131. wchar_t* play;
  132. wchar_t* enqueue;
  133. } viewButtons;
  134. #define ML_IPC_GET_VIEW_BUTTON_TEXT 0x423 // pass viewButtons as the param and gen_ml will fill in appropriate 'play' and 'enqueue' button text to use (saves duplicating translations)
  135. #define ML_MSG_DOWNLOADS_VIEW_LOADED 0x424 // returns TRUE by ml_downloads.dll if loaded and it's view is enabled (used internally)
  136. #define ML_MSG_DOWNLOADS_VIEW_POSITION 0x425 // param1 = parent param2 = 1 (always ensure param2 is set as 1)
  137. // end of those added for 5.66
  138. // types for drag and drop
  139. #define ML_TYPE_UNKNOWN -1
  140. #define ML_TYPE_ITEMRECORDLIST 0 // if this, cast obj to itemRecordList
  141. #define ML_TYPE_FILENAMES 1 // double NULL terminated char * to files, URLS, or playlists
  142. #define ML_TYPE_STREAMNAMES 2 // double NULL terminated char * to URLS, or playlists ( effectively the same as ML_TYPE_FILENAMES, but not for files)
  143. #define ML_TYPE_CDTRACKS 3 // if this, cast obj to itemRecordList (CD tracks) -- filenames should be cda://<drive letter>,<track index>. artist/album/title might be valid (CDDB)
  144. #define ML_TYPE_QUERYSTRING 4 // char * to a query string
  145. #define ML_TYPE_PLAYLIST 5 // mlPlaylist *
  146. #define ML_TYPE_ITEMRECORDLISTW 6 // if this, cast obj to itemRecordListW
  147. // added from 5.36+
  148. #define ML_TYPE_FILENAMESW 7 // double NULL terminated wchar_t * to files, URLS, or playlists
  149. #define ML_TYPE_STREAMNAMESW 8 // double NULL terminated wchar_t * to URLS, or playlists ( effectively the same as ML_TYPE_FILENAMESW, but not for files)
  150. #define ML_TYPE_PLAYLISTS 9 // mlPlaylist **, null terminated
  151. #define ML_TYPE_TREEITEM 69 // uhh?
  152. typedef struct
  153. {
  154. const wchar_t *filename;
  155. const wchar_t *title;
  156. // only fill in the following two if already know. don't calculate it just for the struct.
  157. // put -1 for "don't know"
  158. int numItems;
  159. int length; // in seconds.
  160. } mlPlaylist;
  161. // if you wish to put your tree items under "devices", use this constant for ML_IPC_ADDTREEITEM
  162. #define ML_TREEVIEW_ID_DEVICES 10000
  163. // children communicate back to the media library by SendMessageW(plugin.hwndLibraryParent,WM_ML_IPC,param,ML_IPC_X);
  164. #define WM_ML_IPC WM_USER+0x1000
  165. #define ML_IPC_GETCURRENTVIEW 0x090 // Returns HWND to the currently selected view or NULL if nothing selected or error. (WA 5.22 and higher)
  166. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  167. // Old Tree Item API (deprecated)
  168. //
  169. #define ML_IPC_ADDTREEITEM 0x0101 // pass mlAddTreeItemStruct as the param
  170. #define ML_IPC_SETTREEITEM 0x0102 // pass mlAddTreeItemStruct with id valid
  171. #define ML_IPC_DELTREEITEM 0x0103 // pass param of tree item to remove
  172. #define ML_IPC_GETCURTREEITEM 0x0104 // returns current tree item param or 0 if none
  173. #define ML_IPC_SETCURTREEITEM 0x0105 // selects the tree item passed, returns 1 if found, 0 if not
  174. #define ML_IPC_GETTREE 0x0106 // returns a HMENU with all the tree items. the caller needs to delete the returned handle! pass mlGetTreeStruct as the param
  175. /*
  176. ** This will produce a menu of every item in the media library left pane.
  177. ** mlGetTreeStruct mgts = { 0, 45000, -1 };
  178. ** HMENU media_library_menu = (HMENU)SendMessageW(plugin.hwndLibraryParent,WM_ML_IPC,(WPARAM)&mgts,ML_IPC_GETTREE);
  179. ** if(media_library_menu){
  180. ** // show or insert the menu as applicable
  181. ** }
  182. **
  183. ** Whereas this will produce a menu just of the available media library playlists stored.
  184. ** mlGetTreeStruct mgts = { TREE_PLAYLISTS, 45000, -1 };
  185. ** HMENU playlists_menu = (HMENU)SendMessageW(plugin.hwndLibraryParent,WM_ML_IPC,(WPARAM)&mgts,ML_IPC_GETTREE);
  186. ** if(playlists_menu){
  187. ** // show or insert the menu as applicable
  188. ** }
  189. */
  190. /* deprecated. Use MLTREEITEM instead */
  191. typedef struct
  192. {
  193. INT_PTR parent_id; //0=root, or ML_TREEVIEW_ID_*
  194. char *title;
  195. int has_children;
  196. INT_PTR this_id; //filled in by the library on ML_IPC_ADDTREEITEM
  197. } mlAddTreeItemStruct;
  198. #define TREE_LOCALMEDIA 1000
  199. #define TREE_PLAYLISTS 3001
  200. #define TREE_QUERIES 1000
  201. typedef struct
  202. {
  203. int item_start; // TREE_PLAYLISTS,...
  204. int cmd_offset; // menu command offset if you need to make a command proxy, 0 otherwise
  205. int max_numitems; // maximum number of items you wish to insert or -1 for no limit
  206. } mlGetTreeStruct;
  207. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  208. /// For Predixis, with Love
  209. /// deprecated (never use!!!)
  210. ///
  211. #define ML_IPC_ADDTREEITEM_EX 0x0111 // pass mlAddTreeItemStructEx as the param
  212. #define ML_IPC_SETTREEITEM_EX 0x0112 // pass mlAddTreeItemStructEx with this_id valid
  213. typedef struct {
  214. INT_PTR parent_id; //0=root, or ML_TREEVIEW_ID_*
  215. char *title;
  216. int has_children;
  217. INT_PTR this_id; //filled in by the library on ML_IPC_ADDTREEITEM
  218. int imageIndex; // index of the image you want to be associated with your item
  219. } mlAddTreeItemStructEx;
  220. /// deprecatded (never use!!!)
  221. #define ML_IPC_ADDTREEIMAGE 0x110 // adds tree image to the ml. Use mlAddTreeImageStruct as the param.
  222. /// end of predixis special
  223. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  224. // Tree Item API (starting from 5.3)
  225. //
  226. #define ML_IPC_TREEITEM_GETHANDLE 0x120 // Gives you HANDLE to the item with specified ID in the param
  227. #define ML_IPC_TREEITEM_GETCHILD 0x121 // Returns HANDLE to the child item for the item HANDLE specified as a param.
  228. #define ML_IPC_TREEITEM_GETNEXT 0x122 // Returns HANDLE to the next item for the item HANDLE specified as a param.
  229. #define ML_IPC_TREEITEM_GETSELECTED 0x123 // Returns HANDLE to selected item.
  230. #define ML_IPC_TREEITEM_GETINFO 0x124 // Pass MLTREEITEMINFO as a param. return TRUE - if ok
  231. #define ML_IPC_TREEITEM_SETINFO 0x125 // Pass MLTREEITEMINFO as a param. return TRUE - if ok
  232. #define ML_IPC_TREEITEM_ADD 0x126 // Adds new item using MLTREEITEM passed as a param
  233. #define ML_IPC_TREEITEM_DELETE 0x127 // Deletes tree item. Pass HANDLE as a param.
  234. #define ML_IPC_TREEITEM_SELECT 0x128 // Selects tree item. Pass HANDLE as a param.
  235. #define ML_IPC_TREEITEM_GETROOT 0x129 // Gets first item.
  236. #define ML_IPC_TREEITEM_INSERT 0x130 // like ML_IPC_TREEITEM_ADD, but id becomes an "insert after" ID
  237. #define ML_IPC_TREEITEM_GETCHILD_ID 0x131 // Returns ID to the child item for the item ID specified as a param.
  238. #define ML_IPC_TREEITEM_GETNEXT_ID 0x132 // Returns ID to the next item for the item ID specified as a param.
  239. #define ML_IPC_TREEITEM_ADDW 0x133 // Adds new item using MLTREEITEMW passed as a param
  240. #define ML_IPC_TREEITEM_INSERTW 0x134 // like ML_IPC_TREEITEM_ADDW, but id becomes an "insert after" ID
  241. #define ML_IPC_TREEITEM_SETINFOW 0x135 // Pass MLTREEITEMINFOW as a param. return TRUE - if ok
  242. #define ML_IPC_TREEITEM_GETINFOW 0x136 // Pass MLTREEITEMINFO as a param. return TRUE - if ok
  243. #define MLTI_ROOT (INT_PTR)TVI_ROOT // can be used in ML_IPC_TREEITEM_GETCHILD
  244. typedef struct {
  245. size_t size; // size of this struct
  246. UINT_PTR id; // depends on contxext
  247. UINT_PTR parentId; // 0 = root, or ML_TREEVIEW_ID_*
  248. char *title; // pointer to the buffer contained item name.
  249. size_t titleLen; // used for GetInfo
  250. BOOL hasChildren; // TRUE - has children
  251. int imageIndex; // index of the associated image
  252. } MLTREEITEM;
  253. typedef struct {
  254. MLTREEITEM item; // item data
  255. UINT mask; // one or more of MLTI_* flags
  256. UINT_PTR handle; // Handle to the item. If handle is NULL item->id will be used
  257. } MLTREEITEMINFO;
  258. typedef struct {
  259. size_t size; // size of this struct
  260. UINT_PTR id; // depends on context
  261. UINT_PTR parentId; // 0 = root, or ML_TREEVIEW_ID_*
  262. wchar_t *title; // pointer to the buffer contained item name.
  263. size_t titleLen; // used for GetInfo
  264. BOOL hasChildren; // TRUE - has children
  265. int imageIndex; // index of the associated image
  266. } MLTREEITEMW;
  267. typedef struct {
  268. MLTREEITEMW item; // item data
  269. UINT mask; // one or more of MLTI_* flags
  270. UINT_PTR handle; // Handle to the item. If handle is NULL item->id will be used
  271. } MLTREEITEMINFOW;
  272. // Flags that used in the MLTREEITEMINFO struct
  273. #define MLTI_CHILDREN TVIF_CHILDREN
  274. #define MLTI_IMAGE TVIF_IMAGE
  275. #define MLTI_TEXT TVIF_TEXT
  276. #define MLTI_ID TVIF_PARAM
  277. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  278. // Tree image (starting from 5.3)
  279. //
  280. #define ML_IPC_TREEIMAGE_ADD 0x140 // adds tree image to the ml. Use MLTREEIMAGE as the param.
  281. typedef struct _COLOR24
  282. {
  283. unsigned char rgbBlue;
  284. unsigned char rgbGreen;
  285. unsigned char rgbRed;
  286. }COLOR24; // color struct
  287. typedef void (*BMPFILTERPROC)(const COLOR24*, const COLOR24*, COLOR24*); // color filter procedure
  288. // you got two colors: color1 and color2 (usualy BG and FG colors) also you as a third parameter
  289. // you get a pixel color value that you need (can) modify
  290. #define FILTER_NO ((BMPFILTERPROC)NULL)
  291. #define FILTER_DEFAULT1 ((BMPFILTERPROC)1)
  292. #define FILTER_DEFAULT2 ((BMPFILTERPROC)2)
  293. #define MLTREEIMAGE_NONE 0
  294. #define MLTREEIMAGE_DEFAULT 1
  295. #define MLTREEIMAGE_BRANCH 2 // calculates at the time
  296. #define MLTREEIMAGE_BRANCH_EXPANDED 3
  297. #define MLTREEIMAGE_BRANCH_COLLAPSED 4
  298. #define MLTREEIMAGE_BRANCH_NOCHILD 5
  299. typedef struct {
  300. HINSTANCE hinst; // hInstance
  301. int resourceId; // resource id
  302. int imageIndex; // set image to specified index (specify -1 to get a new index back)
  303. BMPFILTERPROC filterProc; // pointer to the filter proc to use or one of the FILTER_*
  304. int width; // reserved
  305. int height; // reserved
  306. } MLTREEIMAGE; // basicly ml will read your reosurce when it will need to create your image
  307. #define ML_IPC_NEWPLAYLIST 0x107 // pass hwnd for dialog parent as param
  308. #define ML_IPC_IMPORTPLAYLIST 0x108 // pass hwnd for dialog parent as param
  309. #define ML_IPC_IMPORTCURRENTPLAYLIST 0x109
  310. #define ML_IPC_GETPLAYLISTWND 0x10A
  311. #define ML_IPC_SAVEPLAYLIST 0x10B // pass hwnd for dialog parent as param
  312. #define ML_IPC_OPENPREFS 0x10C
  313. #define ML_IPC_PLAY_PLAYLIST 0x010D // plays the playlist pointed to by the tree item passed, returns 1 if found, 0 if not
  314. #define ML_IPC_LOAD_PLAYLIST 0x010E // loads the playlist pointed to by the tree item passed into the playlist editor, returns 1 if found, 0 if not
  315. #define ML_IPC_REFRESH_PREFS 0x10F // this doesn't belong in here
  316. /** ------------------
  317. ** ml_playlists
  318. ** ------------------ */
  319. #define PL_FLAG_SHOW 1
  320. #define PL_FLAG_SWITCH 2
  321. #define PL_FLAGS_IMPORT 4 // set to have ml_playlists make a copy (only valid for mlAddPlaylist)
  322. #define PL_FLAG_FILL_FILENAME 8 // only valid for mlMakePlaylist
  323. typedef struct
  324. {
  325. size_t size; // size of this struct
  326. const wchar_t *playlistName; // set to NULL (or empty string) to prompt the user for a name
  327. const wchar_t *filename;
  328. int flags; // see PL_FLAG_* above
  329. // the following two items can be optionally filled in (set to -1 otherwise)
  330. // if they aren't set, the playlist file will have to be opened and parsed
  331. // so prepopulating is faster (assuming if you already know the data)
  332. int numItems; // set to -1 if you don't know.
  333. int length; // in seconds, set to -1 if you don't know
  334. } mlAddPlaylist;
  335. #define ML_IPC_PLAYLIST_ADD 0x180 // call to add a new playlist file to the Playlists treeview. pass an mlAddPlaylist *
  336. typedef struct
  337. {
  338. size_t size; // size of this struct
  339. const wchar_t *playlistName; // set to NULL (or empty string) to prompt the user for a name
  340. int type; //ML_TYPE_ITEMRECORDLIST, etc
  341. void *data; // object to load
  342. int flags; // see PL_FLAG_* above
  343. wchar_t filename[MAX_PATH]; // this will get populated if PL_FLAG_FILL_NAME is set
  344. } mlMakePlaylistV2;
  345. // old structure, here to make it easy to do a sizeof() check
  346. typedef struct
  347. {
  348. size_t size; // size of this struct
  349. const wchar_t *playlistName; // set to NULL (or empty string) to prompt the user for a name
  350. int type; //ML_TYPE_ITEMRECORDLIST, etc
  351. void *data; // object to load
  352. int flags; // see PL_FLAG_* above
  353. } mlMakePlaylist;
  354. /* Call to add a new playlist to the Playlists treeview.
  355. It will be automatically created based on the data you pass
  356. type & data follow the same specifications as send-to, drag-and-drop, etc.
  357. */
  358. #define ML_IPC_PLAYLIST_MAKE 0x181 // call to create a new playlist in the treeview based on passed information. pass an mlMakePlaylist *
  359. #define ML_IPC_PLAYLIST_COUNT 0x182
  360. #define ML_IPC_PLAYLIST_INFO 0x183 // pass in the struct below. returns "1" on success and "0" on failure
  361. typedef struct
  362. {
  363. // you fill this in
  364. size_t size; // size of this struct
  365. size_t playlistNum; // number of the playlist you want to retrieve (0 index)
  366. // ml_playlists fills these in
  367. wchar_t playlistName[128];
  368. wchar_t filename[MAX_PATH];
  369. int numItems;
  370. int length; // in seconds
  371. } mlPlaylistInfo;
  372. /** ------------------
  373. **
  374. ** ------------------ */
  375. #define ML_IPC_GETFILEINFO 0x0200 // pass it a &itemRecord with a valid filename (and all other fields NULL), and it will try to fill in the rest
  376. #define ML_IPC_FREEFILEINFO 0x0201 // pass it a &itemRecord that was filled by getfileinfo, it will free the strings it allocated
  377. // added for 5.58+
  378. #define ML_IPC_GETFILEINFOW 0x0202 // pass it a &itemRecordW with a valid filename (and all other fields NULL), and it will try to fill in the rest
  379. #define ML_IPC_FREEFILEINFOW 0x0203 // pass it a &itemRecordW that was filled by getfileinfo, it will free the strings it allocated
  380. #define ML_IPC_HANDLEDRAG 0x0300 // pass it a &mlDropItemStruct it will handle cursors etc (unless flags has the lowest bit set), and it will set result appropriately:
  381. #define ML_IPC_HANDLEDROP 0x0301 // pass it a &mlDropItemStruct with data on drop:
  382. #define ML_IPC_SENDTOWINAMP 0x0302 // send with a mlSendToWinampStruct:
  383. typedef struct {
  384. int type; //ML_TYPE_ITEMRECORDLIST, etc
  385. void *data; // object to play
  386. int enqueue; // low bit set specifies enqueuing, and second bit NOT set specifies that
  387. // the media library should use its default behavior as the user configured it (if
  388. // enqueue is the default, the low bit will be flipped by the library)
  389. } mlSendToWinampStruct;
  390. typedef struct {
  391. char *desc; // str (addition 5.64+ - set as L"-" to create a separator and begin with a # to show as grayed)
  392. intptr_t context; // context passed by ML_MSG_ONSENDTOBUILD
  393. intptr_t user32; // use some unique ptr in memory, you will get it back in ML_MSG_ONSENDTOSELECT...
  394. } mlAddToSendToStruct;
  395. #define ML_IPC_ADDTOSENDTO 0x0400
  396. typedef struct {
  397. wchar_t *desc; // str (addition 5.64+ - set as L"-" to create a separator and begin with a # to show as grayed)
  398. intptr_t context; // context passed by ML_MSG_ONSENDTOBUILD
  399. intptr_t user32; // use some unique ptr in memory, you will get it back in ML_MSG_ONSENDTOSELECT...
  400. } mlAddToSendToStructW;
  401. #define ML_IPC_ADDTOSENDTOW 0x0401 // pass mlAddToSendToStructW
  402. // used to make a submenu in sendto
  403. // pass mlAddToSendToStructW, set desc to 0 to start, set valid desc to end
  404. // user32 is unused
  405. // note: the 5.64+ additions for separators and greyed items do not apply to the branch node
  406. #define ML_IPC_BRANCHSENDTO 0x0402
  407. // follow same rules as ML_IPC_ADDTOSENDTOW, but adds to branch instead of main send-to menu
  408. #define ML_IPC_ADDTOBRANCH 0x0403 // pass mlAddToSendToStructW
  409. #define ML_IPC_HOOKTITLE 0x0440 // this is like winamp's IPC_HOOK_TITLES... :) param1 is waHookTitleStruct
  410. #define ML_IPC_HOOKEXTINFO 0x0441 // called on IPC_GET_EXTENDED_FILE_INFO_HOOKABLE, param1 is extendedFileInfoStruct
  411. #define ML_IPC_HOOKEXTINFOW 0x0442 // called on IPC_GET_EXTENDED_FILE_INFO_HOOKABLEW, param1 is extendedFileInfoStructW
  412. #define ML_IPC_HOOKTITLEW 0x0443 // this is like winamp's IPC_HOOK_TITLESW... :) param1 is waHookTitleStructW
  413. #define ML_HANDLEDRAG_FLAG_NOCURSOR 1
  414. #define ML_HANDLEDRAG_FLAG_NAME 2
  415. typedef struct {
  416. int type; //ML_TYPE_ITEMRECORDLIST, etc
  417. void *data; // NULL if just querying
  418. int result; // filled in by client: -1 if dont allow, 0 if dont know, 1 if allow.
  419. POINT p; // cursor pos in screen coordinates
  420. int flags;
  421. char *name; // only valid if ML_HANDLEDRAG_FLAG_NAME
  422. } mlDropItemStruct;
  423. #define ML_IPC_SKIN_LISTVIEW 0x0500 // pass the hwnd of your listview. returns a handle to use with ML_IPC_UNSKIN_LISTVIEW
  424. #define ML_IPC_UNSKIN_LISTVIEW 0x0501 // pass the handle you got from ML_IPC_SKIN_LISTVIEW
  425. #define ML_IPC_LISTVIEW_UPDATE 0x0502 // pass the handle you got from ML_IPC_SKIN_LISTVIEW
  426. #define ML_IPC_LISTVIEW_DISABLEHSCROLL 0x0503 // pass the handle you got from ML_IPC_SKIN_LISTVIEW
  427. #define ML_IPC_LISTVIEW_DISABLEVSCROLL 0x050A // pass the handle you got from ML_IPC_SKIN_LISTVIEW
  428. #define ML_IPC_LISTVIEW_SHOWSORT 0x0504 // use LV_SKIN_SHOWSORT
  429. #define ML_IPC_LISTVIEW_SORT 0x0505 // use LV_SKIN_SORT
  430. typedef struct
  431. {
  432. INT_PTR listView;
  433. BOOL showSort;
  434. } LV_SKIN_SHOWSORT;
  435. typedef struct
  436. {
  437. INT_PTR listView;
  438. int columnIndex;
  439. BOOL ascending;
  440. } LV_SKIN_SORT;
  441. #define ML_IPC_SKIN_COMBOBOX 0x0508 // pass the hwnd of your combobox to skin, returns a ahndle to use with ML_IPC_UNSKIN_COMBOBOX
  442. #define ML_IPC_UNSKIN_COMBOBOX 0x0509 // pass the handle from ML_IPC_SKIN_COMBOBOX
  443. #define ML_IPC_SKIN_WADLG_GETFUNC 0x0600
  444. // 1: return int (*WADlg_getColor)(int idx); // pass this an index, returns a RGB value (passing 0 or > 3 returns NULL)
  445. // 2: return int (*WADlg_handleDialogMsgs)(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  446. // 3: return void (*WADlg_DrawChildWindowBorders)(HWND hwndDlg, int *tab, int tabsize); // each entry in tab would be the id | DCW_*
  447. // 4: return HBITMAP (*WADlg_getBitmap)(); // a copy of the current skin's genex.bmp
  448. // 32: return void (*childresize_init)(HWND hwndDlg, ChildWndResizeItem *list, int num);
  449. // 33: return void (*childresize_resize)(HWND hwndDlg, ChildWndResizeItem *list, int num);
  450. // 66: return (HFONT) font to use for dialog elements, if desired (0 otherwise)
  451. // itemRecord type for use with ML_TYPE_ITEMRECORDLIST, as well as many other functions
  452. typedef struct
  453. {
  454. char *filename;
  455. char *title;
  456. char *ext;
  457. char *album;
  458. char *artist;
  459. char *comment;
  460. char *genre;
  461. int year;
  462. int track;
  463. int length;
  464. char **extended_info;
  465. // currently defined extended columns (while they are stored internally as integers
  466. // they are passed using extended_info as strings):
  467. // use getRecordExtendedItem and setRecordExtendedItem to get/set.
  468. // for your own internal use, you can set other things, but the following values
  469. // are what we use at the moment. Note that setting other things will be ignored
  470. // by ML_IPC_DB*.
  471. //
  472. //"RATING" file rating. can be 1-5, or 0 or empty for undefined
  473. //"PLAYCOUNT" number of file plays.
  474. //"LASTPLAY" last time played, in standard time_t format
  475. //"LASTUPD" last time updated in library, in standard time_t format
  476. //"FILETIME" last known file time of file, in standard time_t format
  477. //"FILESIZE" last known file size, in kilobytes.
  478. //"BITRATE" file bitrate, in kbps
  479. //"TYPE" - "0" for audio, "1" for video
  480. // TODO list all of the other values available for completeness between this and itemRecordW
  481. //"ISPODCAST",
  482. //"PODCASTCHANNEL",
  483. //"PODCASTPUBDATE",
  484. //"LOSSLESS",
  485. //"CODEC",
  486. //"DIRECTOR",
  487. //"PRODUCER",
  488. //"WIDTH",
  489. //"HEIGHT",
  490. //"MIME",
  491. // TODO END
  492. //"REALSIZE" last known file size, in bytes (provides a 64-bit integer as a string due to 'filesize being limited to 32-bit).
  493. //"DATEADDED" time the file was added to the library, in standard time_t format
  494. } itemRecord;
  495. typedef struct
  496. {
  497. itemRecord *Items;
  498. int Size;
  499. int Alloc;
  500. } itemRecordList;
  501. #include <time.h>
  502. typedef struct
  503. {
  504. wchar_t *key;
  505. wchar_t *value;
  506. } extendedInfoW;
  507. /* sizeof(itemRecordW) should be 128 (on x86). If you use a compiler other than
  508. Microsoft Visual Studio, it's worth checking to make sure it's the same */
  509. typedef struct
  510. {
  511. wchar_t *filename;
  512. wchar_t *title;
  513. wchar_t *ext;
  514. wchar_t *album;
  515. wchar_t *artist;
  516. wchar_t *comment;
  517. wchar_t *genre;
  518. wchar_t *albumartist;
  519. wchar_t *replaygain_album_gain; // these are strings rather than float's to differentiate between '0 gain' and 'not defined'
  520. wchar_t *replaygain_track_gain; // these are strings rather than float's to differentiate between '0 gain' and 'not defined'
  521. wchar_t *publisher;
  522. wchar_t *composer;
  523. int year;
  524. int track;
  525. int tracks;
  526. int length;
  527. int rating; // file rating. can be 1-5, or 0 for undefined
  528. int playcount; // number of file plays.
  529. __time64_t lastplay; // last time played, in standard time_t format
  530. __time64_t lastupd; // last time updated in library, in standard time_t format
  531. __time64_t filetime; // last known file time of file, in standard time_t format
  532. int filesize; // last known file size, in kilobytes.
  533. int bitrate; // file bitrate, in kbps
  534. int type; // 0 for audio, 1 for video
  535. int disc; // disc number
  536. int discs; // number of discs
  537. int bpm;
  538. extendedInfoW *extended_info;
  539. // currently defined extended columns (while they are stored internally as integers
  540. // they are passed using extended_info as strings):
  541. // use getRecordExtendedItem and setRecordExtendedItem to get/set.
  542. // for your own internal use, you can set other things, but the following values
  543. // are what we use at the moment. Note that setting other things will be ignored
  544. // by ML_IPC_DB*.
  545. //
  546. wchar_t *category; // 5.61+: we were able to sneak this in because of padding. it'll be zero on older versions because the structs get memset
  547. } itemRecordW;
  548. typedef struct
  549. {
  550. itemRecordW *Items;
  551. int Size;
  552. int Alloc;
  553. } itemRecordListW;
  554. //
  555. // all return 1 on success, -1 on error. or 0 if not supported, maybe?
  556. // pass these a mlQueryStruct
  557. // results should be zeroed out before running a query, but if you wish you can run multiple queries and
  558. // have it concatenate the results. tho it would be more efficient to just make one query that contains both,
  559. // as running multiple queries might have duplicates etc.
  560. // in general, though, if you need to treat "results" as if they are native, you should use
  561. // copyRecordList to save a copy, then free the results using ML_IPC_DB_FREEQUERYRESULTS.
  562. // if you need to keep an exact copy that you will only read (and will not modify), then you can
  563. // use the one in the mlQueryStruct.
  564. #define ML_IPC_DB_RUNQUERY 0x0700
  565. #define ML_IPC_DB_RUNQUERY_SEARCH 0x0701 // "query" should be interpreted as keyword search instead of query string
  566. #define ML_IPC_DB_RUNQUERY_FILENAME 0x0702 // searches for one exact filename match of "query"
  567. #define ML_IPC_DB_RUNQUERY_INDEX 0x0703 // retrieves item #(int)query [deprecated and doesn't work]
  568. #define ML_IPC_DB_FREEQUERYRESULTS 0x0705 // frees memory allocated by ML_IPC_RUNQUERY (empties results)
  569. typedef struct
  570. {
  571. char *query;
  572. int max_results; // can be 0 for unlimited
  573. itemRecordList results;
  574. } mlQueryStruct;
  575. /* Unicode versions of the above */
  576. #define ML_IPC_DB_RUNQUERYW 0x1700
  577. #define ML_IPC_DB_RUNQUERY_SEARCHW 0x1701 // "query" should be interpreted as keyword search instead of query string
  578. #define ML_IPC_DB_RUNQUERY_FILENAMEW 0x1702 // searches for one exact filename match of "query"
  579. #define ML_IPC_DB_RUNQUERY_INDEXW 0x1703 // retrieves item #(int)query [deprecated and doesn't work]
  580. #define ML_IPC_DB_FREEQUERYRESULTSW 0x1705 // frees memory allocated by ML_IPC_RUNQUERYW (empties results)
  581. typedef struct
  582. {
  583. wchar_t *query;
  584. int max_results; // can be 0 for unlimited
  585. itemRecordListW results;
  586. } mlQueryStructW;
  587. /* ----------------------------- */
  588. // pass these an (itemRecord *) to add/update.
  589. // note that any NULL fields in the itemRecord won't be updated,
  590. // and year, track, or length of -1 prevents updating as well.
  591. #define ML_IPC_DB_UPDATEITEM 0x0706 // returns -2 if item not found in db
  592. #define ML_IPC_DB_ADDORUPDATEITEM 0x0707
  593. #define ML_IPC_DB_REMOVEITEM 0x0708 // pass a char * to the filename to remove. returns -2 if file not found in db.
  594. // added in v5.58
  595. #define ML_IPC_DB_REMOVEITEMW 0x1708 // pass a wchar_t * to the filename to remove. returns -2 if file not found in db.
  596. typedef struct
  597. {
  598. char* fileName; // file name to add
  599. int meta_mode; // metadata get mode (0 - don't use metadata, 1 - use metadata; -1 - read from user settings (ini file)
  600. int gues_mode; // metadata guessing mode (0 - smart, 1 - simple; 2 - no, -1 - read from user settings (ini file)
  601. } LMDB_FILE_ADD_INFO;
  602. #define ML_IPC_DB_UPDATEFILE 0x0710 // Update File in the Local Media Data Base (return -2 if file record not found)
  603. #define ML_IPC_DB_ADDORUPDATEFILE 0x0711 // Adds or Updates File in the Local Media Data Base.
  604. /* Unicode versions of the above */
  605. // pass these an (itemRecordW *) to add/update.
  606. // note that any NULL fields in the itemRecordW won't be updated,
  607. // and year, track, or length of -1 prevents updating as well.
  608. #define ML_IPC_DB_UPDATEITEMW 0x1706 // returns -2 if item not found in db
  609. #define ML_IPC_DB_ADDORUPDATEITEMW 0x1707
  610. typedef struct
  611. {
  612. wchar_t* fileName; // file name to add
  613. int meta_mode; // metadata get mode (0 - don't use metadata, 1 - use metadata; -1 - read from user settings (ini file)
  614. int gues_mode; // metadata guessing mode (0 - smart, 1 - simple; 2 - no, -1 - read from user settings (ini file)
  615. } LMDB_FILE_ADD_INFOW;
  616. #define ML_IPC_DB_UPDATEFILEW 0x1710 // Update File in the Local Media Data Base (return -2 if file record not found) NOTE that this call is broken on 5.33. Only use on 5.34+
  617. #define ML_IPC_DB_ADDORUPDATEFILEW 0x1711 // Adds or Updates File in the Local Media Data Base.
  618. /* ----------------------------- */
  619. #define ML_IPC_DB_SYNCDB 0x0709 // sync db if dirty flags are set. good to do after a batch of updates.
  620. // these return 0 if unsupported, -1 if failed, 1 if succeeded
  621. // pass a winampMediaLibraryPlugin *. Will not call plugin's init() func.
  622. // YOU MUST set winampMediaLibraryPlugin->hDllInstance to NULL, and version to MLHDR_VER
  623. // 5.25+: You can set hDllInstance to valid value.
  624. // This IPC will return -1 on failure, so a good check against old verions
  625. // is to try with hDllInstance set, if it returns -1, try again with hDllInstance=0
  626. #define ML_IPC_ADD_PLUGIN 0x0750
  627. #define ML_IPC_REMOVE_PLUGIN 0x0751 // winampMediaLibraryPlugin * of plugin to remove. Will not call plugin's quit() func
  628. #define ML_IPC_SEND_PLUGIN_MESSAGE 0x0752 // sends message to plugins (wParam = 0, lParam = pointer to the pluginMessage struct)
  629. // pluginMessage struct
  630. typedef struct {
  631. int messageType;
  632. INT_PTR param1;
  633. INT_PTR param2;
  634. INT_PTR param3;
  635. } pluginMessage;
  636. #define ML_IPC_ENSURE_VISIBLE 0x0753 // ensures that the media library is visible
  637. #define ML_IPC_IS_VISIBLE 0x0754 // queries the current visibility status
  638. #define ML_IPC_GET_PARENTAL_RATING 0x0755
  639. #define ML_IPC_TOGGLE_VISIBLE 0x0756
  640. // 5.58+ to fix modern skin focusing issue
  641. #define ML_IPC_FOCUS_TREE 0x0757
  642. /* start of ML_CHILDIPC_* section */
  643. // this gets sent to any child windows of the library windows, and then (if not handled) the library window itself
  644. #define WM_ML_CHILDIPC WM_APP+ 0x800 // avoids conflicts with any windows controls
  645. // lParam = 0x100, wParam = &mlDropItemStruct
  646. #define ML_CHILDIPC_DROPITEM 0x100
  647. // notification only message sent via WM_ML_CHILDIPC when F6 (or the accelerator defined against id 40157)
  648. // is pressed - use this to focus to the searchbar in the view if you have one (usability change for 5.55+)
  649. // lParam == 0x200, wParam = 0
  650. #define ML_CHILDIPC_GO_TO_SEARCHBAR 0x200
  651. // added 5.666+
  652. // notification only message sent via WM_ML_CHILDIPC when F8 (or the accelerator defined against id 40165)
  653. // is pressed - use this to re-run the current search or to act as a way to refresh the current view results
  654. // lParam == 0x300, wParam = 0
  655. #define ML_CHILDIPC_REFRESH_SEARCH 0x300
  656. /* end of ML_CHILDIPC_* section */
  657. // current item ratings
  658. #define ML_IPC_SETRATING 0x0900 // lParam = 0 to 5, rates current track -- inserts it in the db if it's not in it yet
  659. #define ML_IPC_GETRATING 0x0901 // return the current track's rating or 0 if not in db/no rating
  660. // playlist entry rating
  661. typedef struct {
  662. int plentry;
  663. int rating;
  664. } pl_set_rating;
  665. #define ML_IPC_PL_SETRATING 0x0902 // lParam = pointer to pl_set_rating struct
  666. #define ML_IPC_PL_GETRATING 0x0903 // lParam = playlist entry, returns the rating or 0 if not in db/no rating
  667. typedef struct {
  668. HWND dialog_parent; // Use this window as a parent for the query editor dialog
  669. const char *query; // The query to edit, or "" / null for new query
  670. } ml_editquery;
  671. #define ML_IPC_EDITQUERY 0x0904 // lParam = pointer to ml_editquery struct, returns 0 if edition was canceled and 1 on success
  672. // After returning, and if ok was clicked, the struct contains a pointer to the edited query. this pointer is static :
  673. // - do *not* free it
  674. // - if you need to keep it around, _strdup it, as it may be changed later by other plugins calling ML_IPC_EDITQUERY.
  675. typedef struct {
  676. HWND dialog_parent; // Use this window as a parent for the view editor dialog
  677. const char *query; // The query to edit, or "" / null for new views
  678. const char *name; // Name of the view (ignored for new views)
  679. int mode; // View mode (0=simple view, 1=artist/album view, -1=hide mode radio boxes)
  680. } ml_editview;
  681. #define ML_IPC_EDITVIEW 0x0905 // lParam = pointer to ml_editview struct, returns 0 if edition was canceled and 1 on success
  682. // After returning, and if ok was clicked, the struct contains the edited values. String pointers are static:
  683. // - do *not* free them
  684. // - if you need to keep them around, _strdup them, as they may be changed later by other plugins calling ML_IPC_EDITQUERY.
  685. #define ML_IPC_SET_FILE_RATING 0x0906 // lParam = 0 to 5, rates current track -- inserts it in the db if it's not in it yet
  686. #define ML_IPC_GET_FILE_RATING 0x0907 // return the current track's rating or 0 if not in db/no rating
  687. // playlist entry rating
  688. typedef struct {
  689. const char* fileName;
  690. int newRating;
  691. } file_set_rating;
  692. #define ML_IPC_SMARTVIEW_COUNT 0x0908 // returns the number of smartviews. no parameter required
  693. #define ML_IPC_SMARTVIEW_INFO 0x0909 // pass a mlSmartViewInfo*. returns 1 on success and 0 on failure
  694. #define ML_IPC_SMARTVIEW_ADD 0x0910 // pass a mlSmartViewInfo* with filled in size, name, query, mode, iconImgIndex. treeitemid gets filled in. returns 1 on success and 0 on failure
  695. typedef struct
  696. {
  697. // you fill these in
  698. size_t size; // set to sizeof(mlSmartViewInfo)
  699. size_t smartViewNum;
  700. // ml_local fills these in
  701. wchar_t smartViewName[128];
  702. wchar_t smartViewQuery[512];
  703. int mode;
  704. int iconImgIndex;
  705. int treeItemId;
  706. } mlSmartViewInfo;
  707. #define ML_IPC_SET_FILE_RATINGW 0x0911 // lParam = 0 to 5, rates current track -- inserts it in the db if it's not in it yet
  708. #define ML_IPC_GET_FILE_RATINGW 0x0912 // return the current track's rating or 0 if not in db/no rating
  709. // playlist entry rating
  710. typedef struct {
  711. const wchar_t *fileName;
  712. int newRating;
  713. } file_set_ratingW;
  714. // utility functions in ml_lib.cpp
  715. void freeRecordList(itemRecordList *obj);
  716. void emptyRecordList(itemRecordList *obj); // does not free Items
  717. void freeRecord(itemRecord *p);
  718. // if out has items in it copyRecordList will append "in" to "out".
  719. void copyRecordList(itemRecordList *out, const itemRecordList *in);
  720. //copies a record
  721. void copyRecord(itemRecord *out, const itemRecord *in);
  722. void allocRecordList(itemRecordList *obj, int newsize, int granularity
  723. #ifdef __cplusplus
  724. =1024
  725. #endif
  726. );
  727. char *getRecordExtendedItem(const itemRecord *item, const char *name);
  728. void setRecordExtendedItem(itemRecord *item, const char *name, char *value);
  729. #ifdef __cplusplus
  730. // utility functions for itemRecordListW
  731. void freeRecordList(itemRecordListW *obj);
  732. void emptyRecordList(itemRecordListW *obj); // does not free Items
  733. void freeRecord(itemRecordW *p);
  734. wchar_t *getRecordExtendedItem(const itemRecordW *item, const wchar_t *name);
  735. void setRecordExtendedItem(itemRecordW *item, const wchar_t *name, const wchar_t *value);
  736. void copyRecordList(itemRecordListW *out, const itemRecordListW *in);
  737. void copyRecord(itemRecordW *out, const itemRecordW *in);
  738. void allocRecordList(itemRecordListW *obj, int newsize, int granularity=1024);
  739. void convertRecord(itemRecord *output, const itemRecordW *input);
  740. void convertRecord(itemRecordW *output, const itemRecord *input);
  741. void convertRecordList(itemRecordList *output, const itemRecordListW *input);
  742. void convertRecordList(itemRecordListW *output, const itemRecordList *input);
  743. #endif
  744. #define ML_IPC_GRACENOTE 0x1000
  745. #define GRACENOTE_TUID 1
  746. #define GRACENOTE_IS_WORKING 2
  747. #define GRACENOTE_DO_TIMER_STUFF 3
  748. #define GRACENOTE_CANCEL_REQUEST 4
  749. #define ML_IPC_FLICKERFIX 0x1002 /// param = (FLICKERFIX*)ffix; Returns 1 if succesfull. if window already treated will update flag data
  750. #define FFM_ERASE 0x00000000 // flicker treatment will be removed
  751. #define FFM_FORCEERASE 0x01000000 // erase backgrund with speicfied color (WM_ERASEBKGND will fill hdc with color and return 1). Use mode = FFM_MODE | RGB(0,0,0)
  752. #define FFM_NOERASE 0x02000000 // block erase operation ( WM_ERASEBKGND will return 1);
  753. #define FFM_ERASEINPAINT 0x04000000 // forward erase operation to WM_PAINT ( WM_ERASEBKGND will return 0);
  754. typedef struct _FLICKERFIX
  755. {
  756. HWND hwnd; // target hwnd
  757. DWORD mode; // FFM_XXX;
  758. }FLICKERFIX, *PFLICKERFIX;
  759. // resource id of the drag & drop cursor used by the ml plugins
  760. // you can use the following to get the cursor rather than rebundling the same icon
  761. // hDragNDropCursor = LoadCursor(GetModuleHandle("gen_ml.dll"), MAKEINTRESOURCE(ML_IDC_DRAGDROP));
  762. #define ML_IDC_DRAGDROP 107
  763. #endif//_ML_H_