|
#pragma once
// Generic utility namespace for WinAMP modules.
namespace WinAMP
{
#pragma warning( push )
#pragma warning( disable : 4100 ) // unreferenced formal wParam
#include "WA SDK/Winamp/WA_IPC.h"
#pragma warning( pop )
// Must be implemented by the specific WinAMP module that receives the handles
// from WinAMP upon startup.
HWND WinAMPWindowHandle();
HINSTANCE DLLInstanceHandle ();
// Helpers for controlling WinAMP via Windows messages.
inline LRESULT WAMessage( UINT message, WPARAM wParam = 0, LPARAM lParam = 0 ) { return ::SendMessage( WinAMPWindowHandle(), message, wParam, lParam ); }
struct WAMessages
{
// (todo) Fill as needed.
enum
{
StopPlayback = 40047
};
};
inline LRESULT WACommand( LPARAM command, WPARAM parameter = 0 ) { return WAMessage( WM_WA_IPC, parameter, command ); }
template<typename ReturnType>
inline ReturnType WACommand( LPARAM command, WPARAM parameter = 0 ) { return reinterpret_cast<ReturnType>( WACommand( command, parameter ) ); }
inline char const * GetWinAMPIniPath () { return WACommand<char const *>( IPC_GETINIFILE ); }
inline char const * GetIniDirectory () { return WACommand<char const *>( IPC_GETINIDIRECTORY ); }
inline char const * GetPluginDirectory() { return WACommand<char const *>( IPC_GETPLUGINDIRECTORY ); }
static char const pluginIniFileName[] = "plugin.ini";
char const * GetPluginIniPath();
template<class Config>
inline bool ReadConfig( Config & config, char const * const iniSection, char const * const iniFile = GetPluginIniPath() )
{
return ( ::GetPrivateProfileStructA( iniSection, "binaryConfigData", (LPVOID)&config, sizeof( config ), iniFile ) != 0 );
}
template<class Config>
inline bool SaveConfig( Config const & config, char const * const iniSection, char const * const iniFile = GetPluginIniPath() )
{
return ( ::WritePrivateProfileStructA( iniSection, "binaryConfigData", (LPVOID)&config, sizeof( config ), iniFile ) != 0 );
}
} // namespace WinAMP
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.