From LIVECHAT Developer Zone Wiki
#include "stdafx.h"
#include "SamplePlugin.h"
SamplePlugin gPlugin; // one instance of the sample plugin
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
////////////////////////////////////////////////////////////////////////
extern "C" __declspec(dllexport) PLUGININFO* plugin_info(DWORD version)
{
if(version < PLUGIN_MAKE_VERSION(5, 5, 0, 0))
{
MessageBoxW(0, _T("Unable to load plugin. It requires LIVECHAT 5.5.0.0 or later."), _T("LIVECHAT Plugin"),
MB_OK | MB_ICONWARNING | MB_SETFOREGROUND | MB_TOPMOST);
return NULL;
}
return gPlugin.plugin_info(version);
}
extern "C" HWND __declspec(dllexport) load(HINSTANCE instance, HWND hwnd)
{
return gPlugin.load(instance, hwnd);
}
extern "C" int __declspec(dllexport) unload()
{
return gPlugin.unload();
}
////////////////////////////////////////////////////////////////////////////
int SamplePlugin::on_load()
{
LCTOOLBARITEM item = {0};
item.cbSize = sizeof(LCTOOLBARITEM);
item.plugin_name = name();
item.id = 1;
item.caption = _T("Test");
item.icon = LoadIcon(mInstance , MAKEINTRESOURCE(IDI_ICON1));
item.tooltip = _T("Sample tooltip");
item.position = 0;
item.menu = 0;
item.service = _T("OnButtonClick");
call(SVC_ADD_TOOLBARITEM, 0, (LPARAM) &item);
return API_SUCCESS;
}
int SamplePlugin::on_unload()
{
return API_SUCCESS;
}
int SamplePlugin::on_command(LPCTSTR cmd, WPARAM wParam, LPARAM lParam)
{
if (_tcscmp(cmd, _T("OnButtonClick") ) == 0)
{
MessageBox(0, _T("Button pressed"), name(), MB_OK);
return API_SUCCESS;
}
return API_ERROR;
}