⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mlplugin.h

📁 这是一个用于歌词下载、上传、匹配的源代码
💻 H
字号:
#ifndef _ML_PLUGIN_HEADER_
#define _ML_PLUGIN_HEADER_

#include <windows.h>
#include "../MiniLyrics3/MiniLyricsPlugin.h"
#include "IPlayer.h"
#include "assert.h"

extern HINSTANCE		g_hInstance;
extern HMODULE			g_hModMiniLyrics;
extern HWND				g_hwndPlayer;
extern class CMLService	g_MLService;
extern PlayerServiceEntry g_PlayerEntry;
extern char			g_szWorkingFolder[];


#define EmptyStr(str)	(str[0] = '\0')
#define CountOf(arr)		(sizeof(arr) / sizeof(arr[0]))

#define IsEmptyString(str)	(str[0] == '\0')

bool BrowserForFolder(HWND hWnd, LPCTSTR szTitle, LPCTSTR szBeginFolder, LPTSTR szPath);

long PlayerImpService(int nCommand, MLPARAM Param1, MLPARAM Param2);

BOOL GetProgramPath(TCHAR szPath[], HINSTANCE hInstance/* = NULL*/);

char *strcpy_safe(char *strDestination, int nLenMax, const char *strSource);

BOOL IsFileExist(LPCTSTR szFileName);

void DirStringFormat(LPTSTR	szDir);

BOOL InitMiniLyricsPlugin(HINSTANCE hInst, IPlayer *pPlayer);

BOOL WritePrivateProfileInt(
							LPCTSTR lpAppName,  // section name
							LPCTSTR lpKeyName,  // key name
							int nValue,			// int to add
							LPCTSTR lpFileName  // initialization file
							);

class CMLService
{
public:
	enum MLSkinMode
	{
		MLSKIN_PLAYER = 1,
		MLSKIN_ML = 2,
	};

	CMLService() { m_funMLService = NULL; }
	~CMLService() {}

	BOOL SetEntryPoint(MLServiceEntry *pMLEntry)
	{
		assert(pMLEntry);
		assert(pMLEntry->uVersion == ML_IF_VERSION);
		assert(pMLEntry->funMLService);

		if (pMLEntry->uVersion != ML_IF_VERSION)
		{
			MessageBox(NULL, "Unsupported minilyrics interface version!", "MiniLyrics", MB_OK);
			return FALSE;
		}

		m_funMLService = pMLEntry->funMLService;
		return TRUE;
	}

	void AddWndCloseto(HWND hWnd, LPCTSTR szWndClass, LPCTSTR szWndName)
	{
		if (hWnd)
			m_funMLService(MLAddWndCloseToHWND, (MLPARAM)hWnd, 0);
		else
			m_funMLService(MLAddWndCloseToName, (MLPARAM)szWndClass, (MLPARAM)szWndName);
	}

	long Init(HINSTANCE hInstance)
	{
		if (m_funMLService)
			return m_funMLService(MLInit, (MLPARAM)hInstance, 0);
		else
			return 0;
	}

	long Quit()
	{
		if (m_funMLService)
			return m_funMLService(MLQuit, 0, 0);
		else
			return 0;
	}

	void Log(const char *szMessage)
	{
		m_funMLService(MLLog, (MLPARAM)szMessage, 0);
	}

	void OnFullTitleChanged(const char *szFullTitle)
	{
		m_funMLService(MLTitleChanged, (MLPARAM)szFullTitle, 0);
	}

	void OnPlayStateChanged(DWORD dwPlayState)
	{
		m_funMLService(MLPlayerStateChanged, (MLPARAM)dwPlayState, 0);
	}

	void OnPlayTimeChanged(DWORD dwPlayTime)
	{
		m_funMLService(MLPlayPosChanged, (MLPARAM)dwPlayTime, 0);
	}

	// notify messages
	HWND GetMainWindow()
	{
		return (HWND)m_funMLService(MLGetMainWnd, 0, 0);
	}

	// WM_ACTIVATEAPP, bActivate = wParam
	void OnNotifyPlayerActivate(BOOL bActivate)
	{
		m_funMLService(MLNotifyPlayerActive, bActivate, 0);
	}

	// WM_SIZE, uState = wParam
	void OnNotifyPlayerMinRestore(UINT uState)
	{
		m_funMLService(MLNotifyPlayerMinRestore, uState, 0);
	}

	void OnNotifyBeforeTrackMove(HWND hWndTrackAndChain[], int nCount)
	{
		m_funMLService(MLNotifyBeforeTrackMove, (long)hWndTrackAndChain, nCount);
	}

	void OnNotifyTrackMove(int x, int y)
	{
		m_funMLService(MLNotifyTrackMove, x, y);
	}

	void OnNotifyPlayerSkinChanged()
	{
		m_funMLService(MLNotifySkinChanged, 0, 0);
	}

	void About(HWND hWnd)
	{
		m_funMLService(MLAbout, (MLPARAM)hWnd, 0);
	}

	void Config(HWND hWnd)
	{
		m_funMLService(MLConfig, (MLPARAM)hWnd, 0);
	}

	DWORD GetCodePage()
	{
		return DWORD(m_funMLService(MLGetCodePage, 0, 0));
	}

	MLSkinMode GetSkinMode()
	{
		return MLSkinMode(m_funMLService(MLGetSkinMode, 0, 0));
	}

	void SetWa5Bmp(int nBmpType, HBITMAP hBmp)
	{
		m_funMLService(MLSetWa5Bmp, nBmpType, (LPARAM)hBmp);
	}

public:
	FUNMLService	m_funMLService;

};

#endif // _ML_PLUGIN_HEADER_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -