// messages your plugin may receive on MessageProc()
#define ML_MSG_TREE_BEGIN 0x100
#define ML_MSG_TREE_ONCREATEVIEW 0x100 // param1 = param of tree item, param2 is HWND of parent. return HWND if it is us
#define ML_MSG_TREE_ONCLICK 0x101 // param1 = param of tree item, param2 = action type (below), param3 = HWND of main window
#define ML_ACTION_RCLICK 0 // return value should be nonzero if ours
#define ML_ACTION_DBLCLICK 1
#define ML_ACTION_ENTER 2
#define ML_ACTION_LCLICK 3
#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).
// return -1 if not allowed, 1 if allowed, or 0 if not our tree item
#define ML_MSG_TREE_ONDRAG 0x103 // param1 = param of tree item, param2 = POINT * to the mouse position, and param3 = (int *) to the type
// set *(int*)param3 to the ML_TYPE you want and return 1, if you support drag&drop, or -1 to prevent d&d.
#define ML_MSG_TREE_ONDROP 0x104 // param1 = param of tree item, param2 = POINT * to the mouse position
// if you support dropping, send the appropriate ML_IPC_HANDLEDROP using SendMessageW() and return 1, otherwise return -1.
#define ML_MSG_TREE_ONKEYDOWN 0x105 // Send when key pressed
// param1 = param of tree item;
// param2 = pointer to NMTVKEYDOWN
// param3 = tree hwnd
// return 0 if it's not yours, 1 if it is
#define ML_MSG_TREE_END 0x1FF // end of tree specific messages
#define ML_MSG_ONSENDTOBUILD 0x300 // you get sent this when the sendto menu gets built
// param1 = type of source, param2 param to pass as context to ML_IPC_ADDTOSENDTO
// be sure to return 0 to allow other plugins to add their context menus
// if your sendto item is selected, you will get this with your param3 == your user32 (preferably some
// unique identifier (like your plugin message proc). See ML_IPC_ADDTOSENDTO
#define ML_MSG_ONSENDTOSELECT 0x301
// param1 = type of source, param2 = data, param3 = user32
// param1 = write type - added 5.7
// this relates to IPC_WRITECONFIG (see wa_ipc.h) for values sent via 'param1'
#define ML_MSG_WRITE_CONFIG 0x397
// param1 = wchar_t* of the file filepath of the file when playback begins - added 5.7
// this relates to IPC_PLAYING_FILEW (see wa_ipc.h) without the need to subclass Winamp
#define ML_MSG_PLAYING_FILE 0x398
// return TRUE to block the closing of Winamp (relates to IPC_HOOK_OKTOQUIT) - added 5.64+
#define ML_MSG_NOTOKTOQUIT 0x399
// return TRUE and do a config dialog using param1 as a HWND parent for this one
#define ML_MSG_CONFIG 0x400
// return TRUE to allow the plug-in config button to be disabled as applicable
#define ML_MSG_NO_CONFIG 0x401
// added from 5.64+ (internal usage, do not re-use this message range unless allowed)
#define ML_MSG_CLOUD_MIN 0x402
#define ML_MSG_CLOUD_MAX 0x410
// added from 5.66+ (used for some easier plug-in hooking of the views
#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
#define ML_MSG_VIEW_PLAY_ENQUEUE_CHANGE 0x422 // param1 = new state of 'play' / 'enqueue' mode, param2 = new state of 'button grouping mode'
// these can be also read from gen_ml.ini and the [gen_ml_config] using 'enqueuedef' and 'groupbtn' respectively
// note: you can use IPC_GETMLINIFILEW from wa_ipc.h to get the gen_ml.ini path
typedefstruct
{
wchar_t*play;
wchar_t*enqueue;
}viewButtons;
#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)
#define ML_MSG_DOWNLOADS_VIEW_LOADED 0x424 // returns TRUE by ml_downloads.dll if loaded and it's view is enabled (used internally)
#define ML_MSG_DOWNLOADS_VIEW_POSITION 0x425 // param1 = parent param2 = 1 (always ensure param2 is set as 1)
// end of those added for 5.66
// types for drag and drop
#define ML_TYPE_UNKNOWN -1
#define ML_TYPE_ITEMRECORDLIST 0 // if this, cast obj to itemRecordList
#define ML_TYPE_FILENAMES 1 // double NULL terminated char * to files, URLS, or playlists
#define ML_TYPE_STREAMNAMES 2 // double NULL terminated char * to URLS, or playlists ( effectively the same as ML_TYPE_FILENAMES, but not for files)
#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)
#define ML_TYPE_QUERYSTRING 4 // char * to a query string
#define ML_TYPE_PLAYLIST 5 // mlPlaylist *
#define ML_TYPE_ITEMRECORDLISTW 6 // if this, cast obj to itemRecordListW
// added from 5.36+
#define ML_TYPE_FILENAMESW 7 // double NULL terminated wchar_t * to files, URLS, or playlists
#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)
#define ML_IPC_ADDTREEITEM 0x0101 // pass mlAddTreeItemStruct as the param
#define ML_IPC_SETTREEITEM 0x0102 // pass mlAddTreeItemStruct with id valid
#define ML_IPC_DELTREEITEM 0x0103 // pass param of tree item to remove
#define ML_IPC_GETCURTREEITEM 0x0104 // returns current tree item param or 0 if none
#define ML_IPC_SETCURTREEITEM 0x0105 // selects the tree item passed, returns 1 if found, 0 if not
#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
#define ML_IPC_PLAYLIST_MAKE 0x181 // call to create a new playlist in the treeview based on passed information. pass an mlMakePlaylist *
#define ML_IPC_PLAYLIST_COUNT 0x182
#define ML_IPC_PLAYLIST_INFO 0x183 // pass in the struct below. returns "1" on success and "0" on failure
typedefstruct
{
// you fill this in
size_tsize;// size of this struct
size_tplaylistNum;// number of the playlist you want to retrieve (0 index)
// ml_playlists fills these in
wchar_tplaylistName[128];
wchar_tfilename[MAX_PATH];
intnumItems;
intlength;// in seconds
}mlPlaylistInfo;
/** ------------------
**
**------------------*/
#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
#define ML_IPC_FREEFILEINFO 0x0201 // pass it a &itemRecord that was filled by getfileinfo, it will free the strings it allocated
// added for 5.58+
#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
#define ML_IPC_FREEFILEINFOW 0x0203 // pass it a &itemRecordW that was filled by getfileinfo, it will free the strings it allocated
#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:
#define ML_IPC_HANDLEDROP 0x0301 // pass it a &mlDropItemStruct with data on drop:
#define ML_IPC_SENDTOWINAMP 0x0302 // send with a mlSendToWinampStruct:
typedefstruct{
inttype;//ML_TYPE_ITEMRECORDLIST, etc
void*data;// object to play
intenqueue;// low bit set specifies enqueuing, and second bit NOT set specifies that
// the media library should use its default behavior as the user configured it (if
// enqueue is the default, the low bit will be flipped by the library)
}mlSendToWinampStruct;
typedefstruct{
char*desc;// str (addition 5.64+ - set as L"-" to create a separator and begin with a # to show as grayed)
intptr_tcontext;// context passed by ML_MSG_ONSENDTOBUILD
intptr_tuser32;// use some unique ptr in memory, you will get it back in ML_MSG_ONSENDTOSELECT...
}mlAddToSendToStruct;
#define ML_IPC_ADDTOSENDTO 0x0400
typedefstruct{
wchar_t*desc;// str (addition 5.64+ - set as L"-" to create a separator and begin with a # to show as grayed)
intptr_tcontext;// context passed by ML_MSG_ONSENDTOBUILD
intptr_tuser32;// use some unique ptr in memory, you will get it back in ML_MSG_ONSENDTOSELECT...
// note that any NULL fields in the itemRecord won't be updated,
// and year, track, or length of -1 prevents updating as well.
#define ML_IPC_DB_UPDATEITEM 0x0706 // returns -2 if item not found in db
#define ML_IPC_DB_ADDORUPDATEITEM 0x0707
#define ML_IPC_DB_REMOVEITEM 0x0708 // pass a char * to the filename to remove. returns -2 if file not found in db.
// added in v5.58
#define ML_IPC_DB_REMOVEITEMW 0x1708 // pass a wchar_t * to the filename to remove. returns -2 if file not found in db.
typedefstruct
{
char*fileName;// file name to add
intmeta_mode;// metadata get mode (0 - don't use metadata, 1 - use metadata; -1 - read from user settings (ini file)
intgues_mode;// metadata guessing mode (0 - smart, 1 - simple; 2 - no, -1 - read from user settings (ini file)
}LMDB_FILE_ADD_INFO;
#define ML_IPC_DB_UPDATEFILE 0x0710 // Update File in the Local Media Data Base (return -2 if file record not found)
#define ML_IPC_DB_ADDORUPDATEFILE 0x0711 // Adds or Updates File in the Local Media Data Base.
/* Unicode versions of the above */
// pass these an (itemRecordW *) to add/update.
// note that any NULL fields in the itemRecordW won't be updated,
// and year, track, or length of -1 prevents updating as well.
#define ML_IPC_DB_UPDATEITEMW 0x1706 // returns -2 if item not found in db
#define ML_IPC_DB_ADDORUPDATEITEMW 0x1707
typedefstruct
{
wchar_t*fileName;// file name to add
intmeta_mode;// metadata get mode (0 - don't use metadata, 1 - use metadata; -1 - read from user settings (ini file)
intgues_mode;// metadata guessing mode (0 - smart, 1 - simple; 2 - no, -1 - read from user settings (ini file)
}LMDB_FILE_ADD_INFOW;
#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+
#define ML_IPC_DB_ADDORUPDATEFILEW 0x1711 // Adds or Updates File in the Local Media Data Base.
/* ----------------------------- */
#define ML_IPC_DB_SYNCDB 0x0709 // sync db if dirty flags are set. good to do after a batch of updates.
// these return 0 if unsupported, -1 if failed, 1 if succeeded
// pass a winampMediaLibraryPlugin *. Will not call plugin's init() func.
// YOU MUST set winampMediaLibraryPlugin->hDllInstance to NULL, and version to MLHDR_VER
// 5.25+: You can set hDllInstance to valid value.
// This IPC will return -1 on failure, so a good check against old verions
// is to try with hDllInstance set, if it returns -1, try again with hDllInstance=0
#define ML_IPC_ADD_PLUGIN 0x0750
#define ML_IPC_REMOVE_PLUGIN 0x0751 // winampMediaLibraryPlugin * of plugin to remove. Will not call plugin's quit() func
#define ML_IPC_SEND_PLUGIN_MESSAGE 0x0752 // sends message to plugins (wParam = 0, lParam = pointer to the pluginMessage struct)
// pluginMessage struct
typedefstruct{
intmessageType;
INT_PTRparam1;
INT_PTRparam2;
INT_PTRparam3;
}pluginMessage;
#define ML_IPC_ENSURE_VISIBLE 0x0753 // ensures that the media library is visible
#define ML_IPC_IS_VISIBLE 0x0754 // queries the current visibility status
#define ML_IPC_EDITVIEW 0x0905 // lParam = pointer to ml_editview struct, returns 0 if edition was canceled and 1 on success
// After returning, and if ok was clicked, the struct contains the edited values. String pointers are static:
// - do *not* free them
// - if you need to keep them around, _strdup them, as they may be changed later by other plugins calling ML_IPC_EDITQUERY.
#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
#define ML_IPC_GET_FILE_RATING 0x0907 // return the current track's rating or 0 if not in db/no rating
// playlist entry rating
typedefstruct{
constchar*fileName;
intnewRating;
}file_set_rating;
#define ML_IPC_SMARTVIEW_COUNT 0x0908 // returns the number of smartviews. no parameter required
#define ML_IPC_SMARTVIEW_INFO 0x0909 // pass a mlSmartViewInfo*. returns 1 on success and 0 on failure
#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
typedefstruct
{
// you fill these in
size_tsize;// set to sizeof(mlSmartViewInfo)
size_tsmartViewNum;
// ml_local fills these in
wchar_tsmartViewName[128];
wchar_tsmartViewQuery[512];
intmode;
inticonImgIndex;
inttreeItemId;
}mlSmartViewInfo;
#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
#define ML_IPC_GET_FILE_RATINGW 0x0912 // return the current track's rating or 0 if not in db/no rating
// playlist entry rating
typedefstruct{
constwchar_t*fileName;
intnewRating;
}file_set_ratingW;
// utility functions in ml_lib.cpp
voidfreeRecordList(itemRecordList*obj);
voidemptyRecordList(itemRecordList*obj);// does not free Items
voidfreeRecord(itemRecord*p);
// if out has items in it copyRecordList will append "in" to "out".
#define ML_IPC_FLICKERFIX 0x1002 /// param = (FLICKERFIX*)ffix; Returns 1 if succesfull. if window already treated will update flag data
#define FFM_ERASE 0x00000000 // flicker treatment will be removed
#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)