summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-05-17 17:49:56 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-05-17 17:49:56 +0300
commit4c4735a232c680e60a85d0f85e2cb392e012c6e0 (patch)
tree104af4cac8863f6f428a23a579167ab0a5b01d6a
parentbce8bc74daf1c5f510404c8bdf956b41fb1c10fc (diff)
Toaster, TooltipNotify, TrafficCounter, UInfoEx, UserGuide, Variables -> CMPlugin
-rw-r--r--plugins/Toaster/src/main.cpp64
-rw-r--r--plugins/Toaster/src/options.cpp2
-rw-r--r--plugins/Toaster/src/stdafx.h10
-rw-r--r--plugins/TooltipNotify/src/Tooltip.cpp6
-rw-r--r--plugins/TooltipNotify/src/TooltipNotify.cpp17
-rw-r--r--plugins/TooltipNotify/src/main.cpp99
-rw-r--r--plugins/TooltipNotify/src/stdafx.h10
-rw-r--r--plugins/TrafficCounter/src/TrafficCounter.cpp408
-rw-r--r--plugins/TrafficCounter/src/TrafficCounter.h6
-rw-r--r--plugins/TrafficCounter/src/options.cpp2
-rw-r--r--plugins/TrafficCounter/src/stdafx.h10
-rw-r--r--plugins/TrafficCounter/src/vars.cpp89
-rw-r--r--plugins/UserGuide/src/main.cpp64
-rw-r--r--plugins/UserGuide/src/stdafx.h8
-rw-r--r--plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp8
-rw-r--r--plugins/UserInfoEx/src/classPsTree.cpp4
-rw-r--r--plugins/UserInfoEx/src/classPsTreeItem.cpp2
-rw-r--r--plugins/UserInfoEx/src/commonheaders.cpp4
-rw-r--r--plugins/UserInfoEx/src/ctrl_button.cpp2
-rw-r--r--plugins/UserInfoEx/src/ctrl_contact.cpp6
-rw-r--r--plugins/UserInfoEx/src/dlg_anniversarylist.cpp2
-rw-r--r--plugins/UserInfoEx/src/dlg_msgbox.cpp4
-rw-r--r--plugins/UserInfoEx/src/dlg_propsheet.cpp6
-rw-r--r--plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp2
-rw-r--r--plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp2
-rw-r--r--plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp2
-rw-r--r--plugins/UserInfoEx/src/init.cpp44
-rw-r--r--plugins/UserInfoEx/src/mir_icolib.cpp2
-rw-r--r--plugins/UserInfoEx/src/psp_anniversary.cpp4
-rw-r--r--plugins/UserInfoEx/src/psp_options.cpp2
-rw-r--r--plugins/UserInfoEx/src/psp_profile.cpp12
-rw-r--r--plugins/UserInfoEx/src/stdafx.h22
-rw-r--r--plugins/UserInfoEx/src/svc_constants.h270
-rw-r--r--plugins/UserInfoEx/src/svc_refreshci.cpp2
-rw-r--r--plugins/Variables/src/help.cpp28
-rw-r--r--plugins/Variables/src/main.cpp11
-rw-r--r--plugins/Variables/src/options.cpp2
-rw-r--r--plugins/Variables/src/stdafx.h11
-rw-r--r--plugins/Variables/src/variables.cpp2
39 files changed, 600 insertions, 651 deletions
diff --git a/plugins/Toaster/src/main.cpp b/plugins/Toaster/src/main.cpp
index f48c47ea20..406bd52180 100644
--- a/plugins/Toaster/src/main.cpp
+++ b/plugins/Toaster/src/main.cpp
@@ -1,8 +1,9 @@
#include "stdafx.h"
int hLangpack;
+CMPlugin g_plugin;
-HINSTANCE g_hInstance;
+/////////////////////////////////////////////////////////////////////////////////////////
PLUGININFOEX pluginInfo =
{
@@ -18,67 +19,60 @@ PLUGININFOEX pluginInfo =
{ 0x1fdbd8f0, 0x3929, 0x41bc, { 0x92, 0xd1, 0x2, 0x7, 0x79, 0x46, 0x7, 0x69 } }
};
-DWORD WINAPI DllMain(HINSTANCE hInstance, DWORD, LPVOID)
-{
- g_hInstance = hInstance;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
- if (!IsWinVer8Plus())
- {
+ if (!IsWinVer8Plus()) {
MessageBox(nullptr, TranslateT("This plugin requires Windows 8 or higher"), _T(MODULE), MB_OK | MB_ICONERROR);
return nullptr;
}
return &pluginInfo;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+static int OnPreShutdown(WPARAM, LPARAM)
+{
+ CleanupClasses();
+
+ SHFILEOPSTRUCT file_op = {
+ nullptr,
+ FO_DELETE,
+ wszTempDir,
+ L"",
+ FOF_NOERRORUI | FOF_SILENT | FOF_NOCONFIRMATION,
+ false,
+ nullptr,
+ L""
+ };
+ SHFileOperation(&file_op);
+
+ return 0;
+}
+
extern "C" int __declspec(dllexport) Load(void)
{
mir_getLP(&pluginInfo);
HookEvent(ME_OPT_INITIALISE, OnOptionsInitialized);
HookEvent(ME_SYSTEM_PRESHUTDOWN, &OnPreShutdown);
-
+
InitServices();
- if (GetEnvironmentVariableW(L"TEMP", wszTempDir, MAX_PATH) != 0)
- {
+ if (GetEnvironmentVariableW(L"TEMP", wszTempDir, MAX_PATH) != 0) {
wcscat_s(wszTempDir, L"\\Miranda.Toaster");
DWORD dwAttributes = GetFileAttributes(wszTempDir);
if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
CreateDirectoryTreeW(wszTempDir);
}
- else
- {
- MessageBox(nullptr, TranslateT("Failed to create temporary directory"), _T(MODULE), MB_OK | MB_ICONERROR);
- }
+ else MessageBox(nullptr, TranslateT("Failed to create temporary directory"), _T(MODULE), MB_OK | MB_ICONERROR);
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" int __declspec(dllexport) Unload(void)
{
return 0;
}
-
-int OnPreShutdown(WPARAM, LPARAM)
-{
- CleanupClasses();
-
- SHFILEOPSTRUCT file_op = {
- nullptr,
- FO_DELETE,
- wszTempDir,
- L"",
- FOF_NOERRORUI | FOF_SILENT | FOF_NOCONFIRMATION,
- false,
- nullptr,
- L""
- };
- SHFileOperation(&file_op);
-
- return 0;
-} \ No newline at end of file
diff --git a/plugins/Toaster/src/options.cpp b/plugins/Toaster/src/options.cpp
index 9d0c0d4034..7b0f3b5995 100644
--- a/plugins/Toaster/src/options.cpp
+++ b/plugins/Toaster/src/options.cpp
@@ -1,7 +1,7 @@
#include "stdafx.h"
COptions::COptions()
- : CDlgBase(g_hInstance, IDD_OPTIONS_MAIN),
+ : CDlgBase(g_plugin.getInst(), IDD_OPTIONS_MAIN),
m_shortcut(this, IDC_SHORTCUT),
m_preview(this, IDC_PREVIEW),
m_enabled(this, IDC_CHECK_ENABLED)
diff --git a/plugins/Toaster/src/stdafx.h b/plugins/Toaster/src/stdafx.h
index 925a04f86d..1d337c7cf8 100644
--- a/plugins/Toaster/src/stdafx.h
+++ b/plugins/Toaster/src/stdafx.h
@@ -10,7 +10,6 @@
#include <memory>
#include <map>
-#define __NO_CMPLUGIN_NEEDED
#include <newpluginapi.h>
#include <m_system_cpp.h>
#include <m_langpack.h>
@@ -33,8 +32,14 @@ const wchar_t AppUserModelID[] = L"MirandaNG";
#define MODULE "Toaster"
#define CHECKHR(x) if (FAILED(x)) return x;
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODULE)
+ {}
+};
+
class ToastNotification;
-extern HINSTANCE g_hInstance;
extern mir_cs csNotifications;
extern wchar_t wszTempDir[MAX_PATH];
extern OBJLIST<ToastNotification> lstNotifications;
@@ -47,7 +52,6 @@ extern OBJLIST<ToastNotification> lstNotifications;
void CleanupClasses();
void InitServices();
-int OnPreShutdown(WPARAM, LPARAM);
void __stdcall HideAllToasts(void*);
int OnOptionsInitialized(WPARAM wParam, LPARAM);
diff --git a/plugins/TooltipNotify/src/Tooltip.cpp b/plugins/TooltipNotify/src/Tooltip.cpp
index 7552ec858d..014802da07 100644
--- a/plugins/TooltipNotify/src/Tooltip.cpp
+++ b/plugins/TooltipNotify/src/Tooltip.cpp
@@ -20,7 +20,7 @@ CTooltip::CTooltip(CTooltipNotify *pTooltipNotify)
m_hWnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, s_szTooltipClass, nullptr,
WS_POPUP|WS_BORDER, 100, 100, 50, 50, nullptr, nullptr,
- g_hInstDLL, nullptr);
+ g_plugin.getInst(), nullptr);
SetWindowLongPtr(m_hWnd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this));
}
@@ -40,14 +40,14 @@ CTooltip::~CTooltip()
wcexWndClass.cbSize = sizeof(WNDCLASSEX);
wcexWndClass.style = CS_SAVEBITS;
wcexWndClass.lpfnWndProc = (WNDPROC)CTooltip::WindowProcWrapper;
- wcexWndClass.hInstance = g_hInstDLL;
+ wcexWndClass.hInstance = g_plugin.getInst();
wcexWndClass.lpszClassName = s_szTooltipClass;
RegisterClassEx(&wcexWndClass);
}
/*static*/ void CTooltip::Deinitialize()
{
- UnregisterClass(s_szTooltipClass, g_hInstDLL);
+ UnregisterClass(s_szTooltipClass, g_plugin.getInst());
}
LRESULT CALLBACK CTooltip::WindowProcWrapper(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
diff --git a/plugins/TooltipNotify/src/TooltipNotify.cpp b/plugins/TooltipNotify/src/TooltipNotify.cpp
index e513d20e7d..5b0e55ae4b 100644
--- a/plugins/TooltipNotify/src/TooltipNotify.cpp
+++ b/plugins/TooltipNotify/src/TooltipNotify.cpp
@@ -53,7 +53,7 @@ const char *CTooltipNotify::s_szModuleNameOld = "ttntfmod";
//////////////////////////////////////////////////////////////////////
CTooltipNotify::CTooltipNotify() :
-m_bNt50(IsNt50())
+ m_bNt50(IsNt50())
{
if (s_pInstance != nullptr)
throw EAlreadyExists();
@@ -257,7 +257,7 @@ int CTooltipNotify::InitializeOptions(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = 100000000;
- odp.hInstance = g_hInstDLL;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
odp.szTitle.a = LPGEN("Tooltip Notify");
odp.szGroup.a = LPGEN("Popups");
@@ -342,14 +342,9 @@ void CTooltipNotify::EndNotifyAll()
CTooltipNotify::MapTimerIdProtoIter CTooltipNotify::FindProtoByTimer(UINT idTimer)
{
- for (
- MapTimerIdProtoIter iter = m_mapTimerIdProto.begin();
- iter != m_mapTimerIdProto.end();
- ++iter) {
- if (iter->timerId == idTimer) {
+ for (MapTimerIdProtoIter iter = m_mapTimerIdProto.begin(); iter != m_mapTimerIdProto.end(); ++iter)
+ if (iter->timerId == idTimer)
return iter;
- }
- }
return m_mapTimerIdProto.end();
}
@@ -587,11 +582,11 @@ BOOL CTooltipNotify::OptionsDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
}
case IDC_SEL_PROTO:
- DialogBox(g_hInstDLL, MAKEINTRESOURCE(IDD_PROTOS), hDlg, CTooltipNotify::ProtosDlgProcWrapper);
+ DialogBox(g_plugin.getInst(), MAKEINTRESOURCE(IDD_PROTOS), hDlg, CTooltipNotify::ProtosDlgProcWrapper);
break;
case IDC_IGNORE:
- DialogBox(g_hInstDLL, MAKEINTRESOURCE(IDD_CONTACTS), hDlg, CTooltipNotify::ContactsDlgProcWrapper);
+ DialogBox(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CONTACTS), hDlg, CTooltipNotify::ContactsDlgProcWrapper);
break;
default:
diff --git a/plugins/TooltipNotify/src/main.cpp b/plugins/TooltipNotify/src/main.cpp
index 9b84a68cb5..001fa83d7b 100644
--- a/plugins/TooltipNotify/src/main.cpp
+++ b/plugins/TooltipNotify/src/main.cpp
@@ -4,34 +4,19 @@
#include "stdafx.h"
-static int InitializeOptions(WPARAM wParam,LPARAM lParam);
-static int ModulesLoaded(WPARAM wParam,LPARAM lParam);
-static int ContactSettingChanged(WPARAM wParam,LPARAM lParam);
-static int ProtoAck(WPARAM,LPARAM);
-static int ProtoContactIsTyping(WPARAM wParam,LPARAM lParam);
-
static HANDLE g_hContactSettingChanged = nullptr;
static HANDLE g_hOptionsInitialize = nullptr;
static HANDLE g_hModulesLoaded = nullptr;
static HANDLE g_hProtoAck = nullptr;
static HANDLE g_hProtoContactIsTyping = nullptr;
-HINSTANCE g_hInstDLL = nullptr;
-
// Main global object
static CTooltipNotify *g_pTooltipNotify = nullptr;
int hLangpack;
CLIST_INTERFACE *pcli;
+CMPlugin g_plugin;
-//================================================================================
-// plugin init/deinit routines
-//================================================================================
-
-BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD, LPVOID)
-{
- g_hInstDLL = hInstDLL;
- return TRUE;
-}
+/////////////////////////////////////////////////////////////////////////////////////////
static PLUGININFOEX sPluginInfo =
{
@@ -52,72 +37,60 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
return &sPluginInfo;
}
-extern "C" int __declspec(dllexport) Load(void)
-{
- mir_getLP(&sPluginInfo);
- pcli = Clist_GetInterface();
+/////////////////////////////////////////////////////////////////////////////////////////
- g_pTooltipNotify = new CTooltipNotify();
- assert(g_pTooltipNotify!=nullptr);
-
- g_hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
- return 0;
+static int ProtoContactIsTyping(WPARAM wParam, LPARAM lParam)
+{
+ return CTooltipNotify::GetObjInstance()->ProtoContactIsTyping(wParam, lParam);
}
-extern "C" int __declspec(dllexport) Unload(void)
+static int ProtoAck(WPARAM wParam, LPARAM lParam)
{
- if (g_hContactSettingChanged) UnhookEvent(g_hContactSettingChanged);
- if (g_hProtoContactIsTyping) UnhookEvent(g_hProtoContactIsTyping);
- if (g_hProtoAck) UnhookEvent(g_hProtoAck);
- if (g_hOptionsInitialize) UnhookEvent(g_hOptionsInitialize);
- if (g_hModulesLoaded) UnhookEvent(g_hModulesLoaded);
- delete g_pTooltipNotify;
-
- return 0;
+ return CTooltipNotify::GetObjInstance()->ProtoAck(wParam, lParam);
}
+static int ContactSettingChanged(WPARAM wParam, LPARAM lParam)
+{
+ return CTooltipNotify::GetObjInstance()->ContactSettingChanged(wParam, lParam);
+}
+static int InitializeOptions(WPARAM wParam, LPARAM lParam)
+{
+ return CTooltipNotify::GetObjInstance()->InitializeOptions(wParam, lParam);
+}
-//================================================================================
-//================================================================================
-//================================================================================
-
-
-int ModulesLoaded(WPARAM wParam, LPARAM lParam)
+static int ModulesLoaded(WPARAM wParam, LPARAM lParam)
{
g_hContactSettingChanged = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ContactSettingChanged);
g_hProtoAck = HookEvent(ME_PROTO_ACK, ProtoAck);
g_hProtoContactIsTyping = HookEvent(ME_PROTO_CONTACTISTYPING, ProtoContactIsTyping);
- g_hOptionsInitialize = HookEvent(ME_OPT_INITIALISE, InitializeOptions);
+ g_hOptionsInitialize = HookEvent(ME_OPT_INITIALISE, InitializeOptions);
return CTooltipNotify::GetObjInstance()->ModulesLoaded(wParam, lParam);
}
-
-int ProtoContactIsTyping(WPARAM wParam, LPARAM lParam)
-{
- return CTooltipNotify::GetObjInstance()->ProtoContactIsTyping(wParam, lParam);
-}
-
-
-int ProtoAck(WPARAM wParam, LPARAM lParam)
+extern "C" int __declspec(dllexport) Load(void)
{
- return CTooltipNotify::GetObjInstance()->ProtoAck(wParam, lParam);
-}
-
+ mir_getLP(&sPluginInfo);
+ pcli = Clist_GetInterface();
-int ContactSettingChanged(WPARAM wParam, LPARAM lParam)
-{
- return CTooltipNotify::GetObjInstance()->ContactSettingChanged(wParam, lParam);
+ g_pTooltipNotify = new CTooltipNotify();
+ assert(g_pTooltipNotify!=nullptr);
+
+ g_hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
+ return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
-int InitializeOptions(WPARAM wParam, LPARAM lParam)
+extern "C" int __declspec(dllexport) Unload(void)
{
- return CTooltipNotify::GetObjInstance()->InitializeOptions(wParam, lParam);
-}
-
-
-
-
+ if (g_hContactSettingChanged) UnhookEvent(g_hContactSettingChanged);
+ if (g_hProtoContactIsTyping) UnhookEvent(g_hProtoContactIsTyping);
+ if (g_hProtoAck) UnhookEvent(g_hProtoAck);
+ if (g_hOptionsInitialize) UnhookEvent(g_hOptionsInitialize);
+ if (g_hModulesLoaded) UnhookEvent(g_hModulesLoaded);
+ delete g_pTooltipNotify;
+ return 0;
+}
diff --git a/plugins/TooltipNotify/src/stdafx.h b/plugins/TooltipNotify/src/stdafx.h
index d8b6960fde..bfe460cfcd 100644
--- a/plugins/TooltipNotify/src/stdafx.h
+++ b/plugins/TooltipNotify/src/stdafx.h
@@ -13,7 +13,6 @@
#include <algorithm>
#include <vector>
-#define __NO_CMPLUGIN_NEEDED
#include <newpluginapi.h>
#include <m_clistint.h>
#include <m_skin.h>
@@ -28,6 +27,13 @@
#define MODULENAME "TooltipNotify"
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODULENAME)
+ {}
+};
+
#include "version.h"
#include "TooltipNotify.h"
#include "DbHelpers.h"
@@ -35,5 +41,3 @@
#include "Settings.h"
#include "resource.h"
#include "Utils.h"
-
-extern HINSTANCE g_hInstDLL; \ No newline at end of file
diff --git a/plugins/TrafficCounter/src/TrafficCounter.cpp b/plugins/TrafficCounter/src/TrafficCounter.cpp
index 7a43bc55fc..e65fcfdbf5 100644
--- a/plugins/TrafficCounter/src/TrafficCounter.cpp
+++ b/plugins/TrafficCounter/src/TrafficCounter.cpp
@@ -28,10 +28,10 @@ PROTOLIST OverallInfo; // Суммарные данные по видимым а
int NumberOfAccounts;
HWND TrafficHwnd;
-HINSTANCE hInst;
+CMPlugin g_plugin;
CLIST_INTERFACE *pcli;
-
int hLangpack = 0; // Поддержка плагинозависимого перевода.
+
BOOL bPopupExists = FALSE, bVariablesExists = FALSE, bTooltipExists = FALSE;
static wchar_t tszFormat[] =
@@ -97,7 +97,7 @@ POINT TooltipPosition;
BOOL UseKeyColor;
COLORREF KeyColor;
-//---------------------------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////
PLUGININFOEX pluginInfoEx =
{
@@ -118,43 +118,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD)
return &pluginInfoEx;
}
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- DisableThreadLibraryCalls(hInst);
-
- return TRUE;
-}
-
-extern "C" int __declspec(dllexport) Load(void)
-{
- // Получаем дескриптор языкового пакета.
- mir_getLP(&pluginInfoEx);
- pcli = Clist_GetInterface();
-
- HookEvent(ME_OPT_INITIALISE, TrafficCounterOptInitialise);
- HookEvent(ME_SYSTEM_MODULESLOADED, TrafficCounterModulesLoaded);
- HookEvent(ME_PROTO_ACK, ProtocolAckHook);
- HookEvent(ME_PROTO_ACCLISTCHANGED, OnAccountsListChange);
- HookEvent(ME_SYSTEM_PRESHUTDOWN, TrafficCounterShutdown);
- HookEvent(ME_SYSTEM_MODULELOAD, ModuleLoad);
- HookEvent(ME_SYSTEM_MODULEUNLOAD, ModuleLoad);
-
- return 0;
-}
-
-extern "C" int __declspec(dllexport) Unload(void)
-{
- // Удаляем шрифт.
- if (Traffic_h_font) {
- DeleteObject(Traffic_h_font);
- Traffic_h_font = nullptr;
- }
-
- // Убиваем все рабочие данные.
- DestroyProtocolList();
- return 0;
-}
+/////////////////////////////////////////////////////////////////////////////////////////
int TrafficCounterShutdown(WPARAM, LPARAM)
{
@@ -192,117 +156,6 @@ int ModuleLoad(WPARAM, LPARAM)
return 0;
}
-int TrafficCounterModulesLoaded(WPARAM, LPARAM)
-{
- DBVARIANT dbv;
-
- CreateProtocolList();
- ModuleLoad(0, 0);
-
- // Читаем флаги
- unOptions.Flags = db_get_dw(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_WHAT_DRAW, 0x0882);
- Stat_SelAcc = db_get_w(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_STAT_ACC_OPT, 0x01);
-
- // settings for notification
- Traffic_PopupBkColor = db_get_dw(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_POPUP_BKCOLOR, RGB(200, 255, 200));
- Traffic_PopupFontColor = db_get_dw(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_POPUP_FONTCOLOR, RGB(0, 0, 0));
- Traffic_Notify_time_value = db_get_b(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_POPUP_NOTIFY_TIME_VALUE, 10);
- Traffic_Notify_size_value = db_get_w(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_POPUP_NOTIFY_SIZE_VALUE, 100);
-
- // popup timeout
- Traffic_PopupTimeoutDefault = db_get_b(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_POPUP_TIMEOUT_DEFAULT, 1);
- Traffic_PopupTimeoutValue = db_get_b(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_POPUP_TIMEOUT_VALUE, 5);
-
- // Формат счётчика для каждого активного протокола
- if (db_get_ws(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_COUNTER_FORMAT, &dbv) == 0) {
- if (mir_wstrlen(dbv.ptszVal) > 0)
- mir_wstrncpy(Traffic_CounterFormat, dbv.ptszVal, _countof(Traffic_CounterFormat));
- //
- db_free(&dbv);
- }
- else //defaults here
- {
- mir_wstrcpy(Traffic_CounterFormat, tszFormat);
- }
-
- // Формат всплывающих подсказок
- if (db_get_ws(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_TOOLTIP_FORMAT, &dbv) == 0) {
- if (mir_wstrlen(dbv.ptszVal) > 0)
- mir_wstrncpy(Traffic_TooltipFormat, dbv.ptszVal, _countof(Traffic_TooltipFormat));
- //
- db_free(&dbv);
- }
- else //defaults here
- {
- mir_wstrcpy(Traffic_TooltipFormat, L"Traffic Counter");
- }
-
- Traffic_AdditionSpace = db_get_b(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_ADDITION_SPACE, 0);
-
- // Счётчик времени онлайна
- OverallInfo.Total.Timer = db_get_dw(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_TOTAL_ONLINE_TIME, 0);
-
- //register traffic font
- TrafficFontID.cbSize = sizeof(FontIDW);
- mir_wstrcpy(TrafficFontID.group, LPGENW("Traffic counter"));
- mir_wstrcpy(TrafficFontID.name, LPGENW("Font"));
- mir_strcpy(TrafficFontID.dbSettingsGroup, TRAFFIC_SETTINGS_GROUP);
- mir_strcpy(TrafficFontID.prefix, "Font");
- TrafficFontID.flags = FIDF_DEFAULTVALID | FIDF_SAVEPOINTSIZE;
- TrafficFontID.deffontsettings.charset = DEFAULT_CHARSET;
- TrafficFontID.deffontsettings.colour = GetSysColor(COLOR_BTNTEXT);
- TrafficFontID.deffontsettings.size = 12;
- TrafficFontID.deffontsettings.style = 0;
- mir_wstrcpy(TrafficFontID.deffontsettings.szFace, L"Arial");
- TrafficFontID.order = 0;
- Font_RegisterW(&TrafficFontID);
-
- // Регистрируем цвет фона
- TrafficBackgroundColorID.cbSize = sizeof(ColourIDW);
- mir_wstrcpy(TrafficBackgroundColorID.group, LPGENW("Traffic counter"));
- mir_wstrcpy(TrafficBackgroundColorID.name, LPGENW("Font"));
- mir_strcpy(TrafficBackgroundColorID.dbSettingsGroup, TRAFFIC_SETTINGS_GROUP);
- mir_strcpy(TrafficBackgroundColorID.setting, "FontBkColor");
- TrafficBackgroundColorID.defcolour = GetSysColor(COLOR_BTNFACE);
- Colour_RegisterW(&TrafficBackgroundColorID);
-
- HookEvent(ME_FONT_RELOAD, UpdateFonts);
-
- // Добавляем поддержку плагина Variables
- RegisterVariablesTokens();
-
- CreateServiceFunction("TrafficCounter/ShowHide", MenuCommand_TrafficShowHide);
- // Регистрируем горячую клавишу для показа/скрытия фрейма
- {
- HOTKEYDESC hkd = {};
- hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'T');
- hkd.szSection.a = "Traffic Counter";
- hkd.szDescription.a = LPGEN("Show/Hide frame");
- hkd.pszName = "TC_Show_Hide";
- hkd.pszService = "TrafficCounter/ShowHide";
- Hotkey_Register(&hkd);
- }
-
- // Добавляем пункт в главное меню.
- if (unOptions.ShowMainMenuItem)
- Traffic_AddMainMenuItem();
-
- // Создаём контекстное меню.
- if (TrafficPopupMenu = CreatePopupMenu()) {
- AppendMenu(TrafficPopupMenu, MF_STRING, POPUPMENU_HIDE, TranslateT("Hide traffic window"));
- AppendMenu(TrafficPopupMenu, MF_STRING, POPUPMENU_CLEAR_NOW, TranslateT("Clear the current (Now:) value"));
- }
-
- // Регистрируем обработчики событий Netlib
- HookEvent(ME_NETLIB_FASTRECV, TrafficRecv);
- HookEvent(ME_NETLIB_FASTSEND, TrafficSend);
-
- CreateTrafficWindow(pcli->hwndContactList);
- UpdateFonts(0, 0); //Load and create fonts here
-
- return 0;
-}
-
void SaveSettings(BYTE OnlyCnt)
{
unsigned short int i;
@@ -423,7 +276,7 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC)
RGB32BitsBITMAPINFO.bmiHeader.biPlanes = 1;
RGB32BitsBITMAPINFO.bmiHeader.biBitCount = 32;
RGB32BitsBITMAPINFO.bmiHeader.biCompression = BI_RGB;
-
+
HBITMAP hbmp = CreateDIBSection(nullptr, &RGB32BitsBITMAPINFO, DIB_RGB_COLORS, nullptr, nullptr, 0);
HBITMAP oldbmp = (HBITMAP)SelectObject(hdc, hbmp);
@@ -757,7 +610,7 @@ LRESULT CALLBACK TrafficCounterWndProc_MW(HWND hwnd, UINT msg, WPARAM wParam, LP
int i;
//
switch (msg) {
- case (WM_USER + 697) :
+ case (WM_USER + 697):
if (lParam == 666)
DestroyWindow(hwnd);
break;
@@ -987,9 +840,9 @@ void CreateTrafficWindow(HWND hCluiWnd)
wcx.lpfnWndProc = TrafficCounterWndProc_MW;
wcx.cbClsExtra = 0;
wcx.cbWndExtra = 0;
- wcx.hInstance = hInst;
+ wcx.hInstance = g_plugin.getInst();
wcx.hIcon = nullptr;
- wcx.hCursor = LoadCursor(hInst, IDC_ARROW);
+ wcx.hCursor = LoadCursor(g_plugin.getInst(), IDC_ARROW);
wcx.hbrBackground = nullptr;
wcx.lpszMenuName = nullptr;
wcx.lpszClassName = TRAFFIC_COUNTER_WINDOW_CLASS;
@@ -998,7 +851,7 @@ void CreateTrafficWindow(HWND hCluiWnd)
TrafficHwnd = CreateWindowEx(WS_EX_TOOLWINDOW, TRAFFIC_COUNTER_WINDOW_CLASS,
TRAFFIC_COUNTER_WINDOW_CLASS,
WS_CHILDWINDOW | WS_CLIPCHILDREN,
- 0, 0, 0, 0, hCluiWnd, nullptr, hInst, nullptr);
+ 0, 0, 0, 0, hCluiWnd, nullptr, g_plugin.getInst(), nullptr);
if (ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
// Готовимся создавать фрейм
@@ -1089,30 +942,29 @@ void NotifyOnRecv(void)
void CreateProtocolList(void)
{
- int i;
- PROTOACCOUNT **acc;
- //
- Proto_EnumAccounts(&NumberOfAccounts, &acc);
- //
- ProtoList = (PROTOLIST*)mir_alloc(sizeof(PROTOLIST)*(NumberOfAccounts));
- //
- for (i = 0; i < NumberOfAccounts; i++) {
- ProtoList[i].name = mir_strdup(acc[i]->szModuleName);
- ProtoList[i].tszAccountName = mir_wstrdup(acc[i]->tszAccountName);
+ auto &accs = Accounts();
+
+ NumberOfAccounts = accs.getCount();
+ ProtoList = (PROTOLIST*)mir_alloc(sizeof(PROTOLIST)*NumberOfAccounts);
+
+ int i = 0;
+ for (auto &pa : accs) {
+ auto &p = ProtoList[i++];
+ p.name = mir_strdup(pa->szModuleName);
+ p.tszAccountName = mir_wstrdup(pa->tszAccountName);
- ProtoList[i].Flags = db_get_b(NULL, ProtoList[i].name, SETTINGS_PROTO_FLAGS, 3);
- ProtoList[i].CurrentRecvTraffic =
- ProtoList[i].CurrentSentTraffic =
- ProtoList[i].Session.Timer = 0;
+ p.Flags = db_get_b(NULL, p.name, SETTINGS_PROTO_FLAGS, 3);
+ p.CurrentRecvTraffic = p.CurrentSentTraffic = p.Session.Timer = 0;
- ProtoList[i].Enabled = acc[i]->bIsEnabled;
- ProtoList[i].State = 0;
+ p.Enabled = pa->IsEnabled();
+ p.State = 0;
Stat_ReadFile(i);
- ProtoList[i].StartIndex = ProtoList[i].NumberOfRecords - 1;
- ProtoList[i].StartIncoming = ProtoList[i].AllStatistics[ProtoList[i].StartIndex].Incoming;
- ProtoList[i].StartOutgoing = ProtoList[i].AllStatistics[ProtoList[i].StartIndex].Outgoing;
- } // цикл по аккаунтам
+ p.StartIndex = p.NumberOfRecords - 1;
+ p.StartIncoming = p.AllStatistics[p.StartIndex].Incoming;
+ p.StartOutgoing = p.AllStatistics[p.StartIndex].Outgoing;
+ }
+
// Начальные значения для суммарной информации.
OverallInfo.Session.Timer = OverallInfo.Total.Timer = 0;
}
@@ -1130,33 +982,6 @@ void DestroyProtocolList(void)
mir_free(ProtoList);
}
-int ProtocolAckHook(WPARAM, LPARAM lParam)
-{
- ACKDATA *pAck = (ACKDATA*)lParam;
-
- if (ACKTYPE_STATUS == pAck->type) {
- if (ID_STATUS_OFFLINE == pAck->lParam) {
- for (int i = 0; i < NumberOfAccounts; i++) {
- if (!ProtoList[i].name) continue;
- if (!mir_strcmp(ProtoList[i].name, pAck->szModule)) {
- ProtocolIsOffLine(i);
- break;
- }
- }
- }
- else {
- if ((pAck->lParam >= ID_STATUS_ONLINE) && (pAck->lParam <= ID_STATUS_OUTTOLUNCH)) {
- for (int i = 0; i < NumberOfAccounts; i++)
- if (!mir_strcmp(ProtoList[i].name, pAck->szModule)) {
- ProtocolIsOnLine(i);
- break;
- }
- }
- }
- }
- return 0;
-}
-
int UpdateFonts(WPARAM, LPARAM)
{
LOGFONT logfont;
@@ -1197,8 +1022,39 @@ unsigned short int TrafficWindowHeight(void)
return (MaxWndHeight < TrafficFontHeight) ? 0 : MaxWndHeight;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+static int ProtocolAckHook(WPARAM, LPARAM lParam)
+{
+ ACKDATA *pAck = (ACKDATA*)lParam;
+
+ if (ACKTYPE_STATUS == pAck->type) {
+ if (ID_STATUS_OFFLINE == pAck->lParam) {
+ for (int i = 0; i < NumberOfAccounts; i++) {
+ if (!ProtoList[i].name) continue;
+ if (!mir_strcmp(ProtoList[i].name, pAck->szModule)) {
+ ProtocolIsOffLine(i);
+ break;
+ }
+ }
+ }
+ else {
+ if ((pAck->lParam >= ID_STATUS_ONLINE) && (pAck->lParam <= ID_STATUS_OUTTOLUNCH)) {
+ for (int i = 0; i < NumberOfAccounts; i++)
+ if (!mir_strcmp(ProtoList[i].name, pAck->szModule)) {
+ ProtocolIsOnLine(i);
+ break;
+ }
+ }
+ }
+ }
+ return 0;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
// Функция вносит изменения в ProtoList при коммутации аккаунтов
-int OnAccountsListChange(WPARAM wParam, LPARAM lParam)
+
+static int OnAccountsListChange(WPARAM wParam, LPARAM lParam)
{
PROTOACCOUNT *acc = (PROTOACCOUNT*)lParam;
@@ -1219,3 +1075,147 @@ int OnAccountsListChange(WPARAM wParam, LPARAM lParam)
UpdateTrafficWindowSize();
return 0;
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+static int TrafficCounterModulesLoaded(WPARAM, LPARAM)
+{
+ DBVARIANT dbv;
+
+ CreateProtocolList();
+ ModuleLoad(0, 0);
+
+ // Читаем флаги
+ unOptions.Flags = db_get_dw(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_WHAT_DRAW, 0x0882);
+ Stat_SelAcc = db_get_w(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_STAT_ACC_OPT, 0x01);
+
+ // settings for notification
+ Traffic_PopupBkColor = db_get_dw(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_POPUP_BKCOLOR, RGB(200, 255, 200));
+ Traffic_PopupFontColor = db_get_dw(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_POPUP_FONTCOLOR, RGB(0, 0, 0));
+ Traffic_Notify_time_value = db_get_b(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_POPUP_NOTIFY_TIME_VALUE, 10);
+ Traffic_Notify_size_value = db_get_w(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_POPUP_NOTIFY_SIZE_VALUE, 100);
+
+ // popup timeout
+ Traffic_PopupTimeoutDefault = db_get_b(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_POPUP_TIMEOUT_DEFAULT, 1);
+ Traffic_PopupTimeoutValue = db_get_b(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_POPUP_TIMEOUT_VALUE, 5);
+
+ // Формат счётчика для каждого активного протокола
+ if (db_get_ws(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_COUNTER_FORMAT, &dbv) == 0) {
+ if (mir_wstrlen(dbv.ptszVal) > 0)
+ mir_wstrncpy(Traffic_CounterFormat, dbv.ptszVal, _countof(Traffic_CounterFormat));
+ //
+ db_free(&dbv);
+ }
+ else //defaults here
+ {
+ mir_wstrcpy(Traffic_CounterFormat, tszFormat);
+ }
+
+ // Формат всплывающих подсказок
+ if (db_get_ws(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_TOOLTIP_FORMAT, &dbv) == 0) {
+ if (mir_wstrlen(dbv.ptszVal) > 0)
+ mir_wstrncpy(Traffic_TooltipFormat, dbv.ptszVal, _countof(Traffic_TooltipFormat));
+ //
+ db_free(&dbv);
+ }
+ else //defaults here
+ {
+ mir_wstrcpy(Traffic_TooltipFormat, L"Traffic Counter");
+ }
+
+ Traffic_AdditionSpace = db_get_b(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_ADDITION_SPACE, 0);
+
+ // Счётчик времени онлайна
+ OverallInfo.Total.Timer = db_get_dw(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_TOTAL_ONLINE_TIME, 0);
+
+ //register traffic font
+ TrafficFontID.cbSize = sizeof(FontIDW);
+ mir_wstrcpy(TrafficFontID.group, LPGENW("Traffic counter"));
+ mir_wstrcpy(TrafficFontID.name, LPGENW("Font"));
+ mir_strcpy(TrafficFontID.dbSettingsGroup, TRAFFIC_SETTINGS_GROUP);
+ mir_strcpy(TrafficFontID.prefix, "Font");
+ TrafficFontID.flags = FIDF_DEFAULTVALID | FIDF_SAVEPOINTSIZE;
+ TrafficFontID.deffontsettings.charset = DEFAULT_CHARSET;
+ TrafficFontID.deffontsettings.colour = GetSysColor(COLOR_BTNTEXT);
+ TrafficFontID.deffontsettings.size = 12;
+ TrafficFontID.deffontsettings.style = 0;
+ mir_wstrcpy(TrafficFontID.deffontsettings.szFace, L"Arial");
+ TrafficFontID.order = 0;
+ Font_RegisterW(&TrafficFontID);
+
+ // Регистрируем цвет фона
+ TrafficBackgroundColorID.cbSize = sizeof(ColourIDW);
+ mir_wstrcpy(TrafficBackgroundColorID.group, LPGENW("Traffic counter"));
+ mir_wstrcpy(TrafficBackgroundColorID.name, LPGENW("Font"));
+ mir_strcpy(TrafficBackgroundColorID.dbSettingsGroup, TRAFFIC_SETTINGS_GROUP);
+ mir_strcpy(TrafficBackgroundColorID.setting, "FontBkColor");
+ TrafficBackgroundColorID.defcolour = GetSysColor(COLOR_BTNFACE);
+ Colour_RegisterW(&TrafficBackgroundColorID);
+
+ HookEvent(ME_FONT_RELOAD, UpdateFonts);
+
+ // Добавляем поддержку плагина Variables
+ RegisterVariablesTokens();
+
+ CreateServiceFunction("TrafficCounter/ShowHide", MenuCommand_TrafficShowHide);
+ // Регистрируем горячую клавишу для показа/скрытия фрейма
+ {
+ HOTKEYDESC hkd = {};
+ hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'T');
+ hkd.szSection.a = "Traffic Counter";
+ hkd.szDescription.a = LPGEN("Show/Hide frame");
+ hkd.pszName = "TC_Show_Hide";
+ hkd.pszService = "TrafficCounter/ShowHide";
+ Hotkey_Register(&hkd);
+ }
+
+ // Добавляем пункт в главное меню.
+ if (unOptions.ShowMainMenuItem)
+ Traffic_AddMainMenuItem();
+
+ // Создаём контекстное меню.
+ if (TrafficPopupMenu = CreatePopupMenu()) {
+ AppendMenu(TrafficPopupMenu, MF_STRING, POPUPMENU_HIDE, TranslateT("Hide traffic window"));
+ AppendMenu(TrafficPopupMenu, MF_STRING, POPUPMENU_CLEAR_NOW, TranslateT("Clear the current (Now:) value"));
+ }
+
+ // Регистрируем обработчики событий Netlib
+ HookEvent(ME_NETLIB_FASTRECV, TrafficRecv);
+ HookEvent(ME_NETLIB_FASTSEND, TrafficSend);
+
+ CreateTrafficWindow(pcli->hwndContactList);
+ UpdateFonts(0, 0); //Load and create fonts here
+ return 0;
+}
+
+extern "C" int __declspec(dllexport) Load(void)
+{
+ // Получаем дескриптор языкового пакета.
+ mir_getLP(&pluginInfoEx);
+ pcli = Clist_GetInterface();
+
+ HookEvent(ME_OPT_INITIALISE, TrafficCounterOptInitialise);
+ HookEvent(ME_SYSTEM_MODULESLOADED, TrafficCounterModulesLoaded);
+ HookEvent(ME_PROTO_ACK, ProtocolAckHook);
+ HookEvent(ME_PROTO_ACCLISTCHANGED, OnAccountsListChange);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, TrafficCounterShutdown);
+ HookEvent(ME_SYSTEM_MODULELOAD, ModuleLoad);
+ HookEvent(ME_SYSTEM_MODULEUNLOAD, ModuleLoad);
+
+ return 0;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+extern "C" int __declspec(dllexport) Unload(void)
+{
+ // Удаляем шрифт.
+ if (Traffic_h_font) {
+ DeleteObject(Traffic_h_font);
+ Traffic_h_font = nullptr;
+ }
+
+ // Убиваем все рабочие данные.
+ DestroyProtocolList();
+ return 0;
+}
diff --git a/plugins/TrafficCounter/src/TrafficCounter.h b/plugins/TrafficCounter/src/TrafficCounter.h
index a11f4178be..46d24e00d9 100644
--- a/plugins/TrafficCounter/src/TrafficCounter.h
+++ b/plugins/TrafficCounter/src/TrafficCounter.h
@@ -59,20 +59,20 @@ int TrafficSend(WPARAM wParam,LPARAM lParam);
/*====== ФУНКЦИИ МОДУЛЯ =====*/
int TrafficCounterOptInitialise(WPARAM wParam,LPARAM lParam);
-int TrafficCounterModulesLoaded(WPARAM wParam,LPARAM lParam);
int TrafficCounterShutdown(WPARAM wParam,LPARAM lParam);
int ModuleLoad(WPARAM wParam, LPARAM lParam);
void SaveSettings(BYTE);
void CreateTrafficWindow(HWND);
+
//popup
void UpdateNotifyTimer(void);
void NotifyOnSend(void);
void NotifyOnRecv(void);
+
//time counter
-int ProtocolAckHook(WPARAM wParam,LPARAM lParam);
void CreateProtocolList(void);
void DestroyProtocolList(void);
-int OnAccountsListChange(WPARAM wParam, LPARAM lParam);
+
//font service suppot
int UpdateFonts(WPARAM wParam, LPARAM lParam);
void UpdateTrafficWindowSize(void);
diff --git a/plugins/TrafficCounter/src/options.cpp b/plugins/TrafficCounter/src/options.cpp
index 16cfb39ab7..1da2a9ee09 100644
--- a/plugins/TrafficCounter/src/options.cpp
+++ b/plugins/TrafficCounter/src/options.cpp
@@ -344,7 +344,7 @@ int TrafficCounterOptInitialise(WPARAM wParam, LPARAM)
// Main options page
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = 900000000;
- odp.hInstance = hInst;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_TRAFFIC);
odp.szGroup.a = LPGEN("Services");
odp.szTab.a = LPGEN("Options");
diff --git a/plugins/TrafficCounter/src/stdafx.h b/plugins/TrafficCounter/src/stdafx.h
index 728a2a7ecc..fc5fb36f37 100644
--- a/plugins/TrafficCounter/src/stdafx.h
+++ b/plugins/TrafficCounter/src/stdafx.h
@@ -27,7 +27,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <win2k.h>
#include <m_system.h>
-#define __NO_CMPLUGIN_NEEDED
#include <newpluginapi.h>
#include <m_netlib.h>
#include <m_langpack.h>
@@ -53,6 +52,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "statistics.h"
#include "TrafficCounter.h"
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(TRAFFIC_SETTINGS_GROUP)
+ {}
+};
+
#pragma pack(push)
#pragma pack(1)
typedef struct
@@ -142,8 +148,6 @@ typedef union
};
} uTCFLAGS;
-extern HINSTANCE hInst;
-
extern HWND TrafficHwnd;
extern PROTOLIST *ProtoList;
extern uTCFLAGS unOptions;
diff --git a/plugins/TrafficCounter/src/vars.cpp b/plugins/TrafficCounter/src/vars.cpp
index fdbb22892b..54f28fc23f 100644
--- a/plugins/TrafficCounter/src/vars.cpp
+++ b/plugins/TrafficCounter/src/vars.cpp
@@ -1,5 +1,5 @@
/*
-Traffic Counter plugin for Miranda IM
+Traffic Counter plugin for Miranda IM
Copyright 2007-2011 Mironych.
This program is free software; you can redistribute it and/or
@@ -30,33 +30,26 @@ static wchar_t* GetTraffic(ARGUMENTSINFO *ai)
if (ai->argc != 5) return nullptr;
- if (!mir_wstrcmp(ai->targv[1], L"overall"))
- {
+ if (!mir_wstrcmp(ai->targv[1], L"overall")) {
tmpsn = OverallInfo.CurrentSentTraffic;
tmprn = OverallInfo.CurrentRecvTraffic;
tmpst = OverallInfo.TotalSentTraffic;
tmprt = OverallInfo.TotalRecvTraffic;
}
- else
- if (!mir_wstrcmp(ai->targv[1], L"summary"))
- {
+ else if (!mir_wstrcmp(ai->targv[1], L"summary")) {
for (ed = 0; ed < NumberOfAccounts; ed++)
- if (ProtoList[ed].Visible)
- {
+ if (ProtoList[ed].Visible) {
tmpsn += ProtoList[ed].CurrentSentTraffic;
tmprn += ProtoList[ed].CurrentRecvTraffic;
tmpst += ProtoList[ed].TotalSentTraffic;
tmprt += ProtoList[ed].TotalRecvTraffic;
}
}
- else
- { // Ищем индекс протокола, переданного первым аргументом
- for (tmp = ed = 0; ed < NumberOfAccounts; ed++)
- {
+ else { // Ищем индекс протокола, переданного первым аргументом
+ for (tmp = ed = 0; ed < NumberOfAccounts; ed++) {
if (!ProtoList[ed].name) continue;
wchar_t *buf = mir_a2u(ProtoList[ed].name);
- if (!mir_wstrcmp(buf, ai->targv[1]))
- {
+ if (!mir_wstrcmp(buf, ai->targv[1])) {
tmpsn = ProtoList[ed].CurrentSentTraffic;
tmprn = ProtoList[ed].CurrentRecvTraffic;
tmpst = ProtoList[ed].TotalSentTraffic;
@@ -68,35 +61,34 @@ static wchar_t* GetTraffic(ARGUMENTSINFO *ai)
if (tmp != 0xAA) return nullptr;
}
- if (!mir_wstrcmp(ai->targv[2], L"now"))
- {
+ if (!mir_wstrcmp(ai->targv[2], L"now")) {
if (!mir_wstrcmp(ai->targv[3], L"sent")) tmp = tmpsn;
else
- if (!mir_wstrcmp(ai->targv[3], L"received")) tmp = tmprn;
- else
- if (!mir_wstrcmp(ai->targv[3], L"both")) tmp = tmprn + tmpsn;
- else return nullptr;
+ if (!mir_wstrcmp(ai->targv[3], L"received")) tmp = tmprn;
+ else
+ if (!mir_wstrcmp(ai->targv[3], L"both")) tmp = tmprn + tmpsn;
+ else return nullptr;
}
- else
- if (!mir_wstrcmp(ai->targv[2], L"total"))
- {
+ else if (!mir_wstrcmp(ai->targv[2], L"total")) {
if (!mir_wstrcmp(ai->targv[3], L"sent")) tmp = tmpst;
else
- if (!mir_wstrcmp(ai->targv[3], L"received")) tmp = tmprt;
- else
- if (!mir_wstrcmp(ai->targv[3], L"both")) tmp = tmprt + tmpst;
- else return nullptr;
+ if (!mir_wstrcmp(ai->targv[3], L"received")) tmp = tmprt;
+ else
+ if (!mir_wstrcmp(ai->targv[3], L"both")) tmp = tmprt + tmpst;
+ else return nullptr;
}
else return nullptr;
- if (!mir_wstrcmp(ai->targv[4], L"b")) ed = 0;
+ if (!mir_wstrcmp(ai->targv[4], L"b"))
+ ed = 0;
+ else if (!mir_wstrcmp(ai->targv[4], L"k"))
+ ed = 1;
+ else if (!mir_wstrcmp(ai->targv[4], L"m"))
+ ed = 2;
+ else if (!mir_wstrcmp(ai->targv[4], L"d"))
+ ed = 3;
else
- if (!mir_wstrcmp(ai->targv[4], L"k")) ed = 1;
- else
- if (!mir_wstrcmp(ai->targv[4], L"m")) ed = 2;
- else
- if (!mir_wstrcmp(ai->targv[4], L"d")) ed = 3;
- else return nullptr;
+ return nullptr;
// Получаем форматированную строку и возвращаем указатель на неё.
// Сначала узнаем размер буфера.
@@ -113,30 +105,29 @@ static wchar_t* GetTraffic(ARGUMENTSINFO *ai)
static wchar_t* GetTime(ARGUMENTSINFO *ai)
{
BYTE ed, flag;
- DWORD Duration;
+ DWORD Duration = 0;
if (ai->argc != 4) return nullptr;
// Ищем индекс протокола, переданного первым аргументом
- for (flag = ed = 0; ed < NumberOfAccounts; ed++)
- {
+ for (flag = ed = 0; ed < NumberOfAccounts; ed++) {
wchar_t *buf;
if (!ProtoList[ed].name) continue;
buf = mir_a2u(ProtoList[ed].name);
- if (!mir_wstrcmp(buf, ai->targv[1]))
- {
+ if (!mir_wstrcmp(buf, ai->targv[1])) {
flag = 0xAA;
if (!mir_wstrcmp(ai->targv[2], L"now"))
Duration = ProtoList[ed].Session.Timer;
else if (!mir_wstrcmp(ai->targv[2], L"total"))
Duration = ProtoList[ed].Total.Timer;
- else flag = 0;
+ else
+ flag = 0;
break;
}
mir_free(buf);
}
- if ( (flag != 0xAA) && !mir_wstrcmp(ai->targv[1], L"summary") )
- {
+
+ if ((flag != 0xAA) && !mir_wstrcmp(ai->targv[1], L"summary")) {
flag = 0xAA;
if (!mir_wstrcmp(ai->targv[2], L"now"))
Duration = OverallInfo.Session.Timer;
@@ -144,25 +135,27 @@ static wchar_t* GetTime(ARGUMENTSINFO *ai)
Duration = OverallInfo.Total.Timer;
else flag = 0;
}
-
- if (flag != 0xAA) return nullptr;
+
+ if (flag != 0xAA)
+ return nullptr;
// Получаем форматированную строку и возвращаем указатель на неё.
// Сначала узнаем размер буфера.
size_t l = GetDurationFormatM(Duration, ai->targv[3], nullptr, 0);
wchar_t *res = (wchar_t*)mir_alloc(l * sizeof(wchar_t));
- if (!res) return nullptr;
+ if (!res)
+ return nullptr;
+
GetDurationFormatM(Duration, ai->targv[3], res, l);
-
return res;
}
void RegisterVariablesTokens(void)
{
TOKENREGISTER trs;
-
+
if (!bVariablesExists) return;
-
+
memset(&trs, 0, sizeof(trs));
trs.cbSize = sizeof(TOKENREGISTER);
diff --git a/plugins/UserGuide/src/main.cpp b/plugins/UserGuide/src/main.cpp
index 593d79a022..c1be1d50db 100644
--- a/plugins/UserGuide/src/main.cpp
+++ b/plugins/UserGuide/src/main.cpp
@@ -1,10 +1,12 @@
#include "stdafx.h"
-HINSTANCE hInst;
-
+CMPlugin g_plugin;
int hLangpack;
-PLUGININFOEX pluginInfo = {
+/////////////////////////////////////////////////////////////////////////////////////////
+
+PLUGININFOEX pluginInfo =
+{
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
@@ -14,38 +16,39 @@ PLUGININFOEX pluginInfo = {
__AUTHORWEB,
UNICODE_AWARE,
// 297EC1E7-41B7-41F9-BB91-EFA95028F16C
- {0x297ec1e7, 0x41b7, 0x41f9, {0xbb, 0x91, 0xef, 0xa9, 0x50, 0x28, 0xf1, 0x6c}}
+ { 0x297ec1e7, 0x41b7, 0x41f9, {0xbb, 0x91, 0xef, 0xa9, 0x50, 0x28, 0xf1, 0x6c }}
};
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
+{
+ return &pluginInfo;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
static INT_PTR ShowGuideFile(WPARAM, LPARAM)
{
- LPTSTR pszDirName = (LPTSTR)mir_alloc(250*sizeof(wchar_t));
- LPTSTR pszFileName = (LPTSTR)mir_alloc(250*sizeof(wchar_t));
+ LPTSTR pszDirName = (LPTSTR)mir_alloc(250 * sizeof(wchar_t));
+ LPTSTR pszFileName = (LPTSTR)mir_alloc(250 * sizeof(wchar_t));
wchar_t *ptszHelpFile = db_get_wsa(NULL, "UserGuide", "PathToHelpFile");
-
- if (ptszHelpFile==nullptr)
- {
- mir_wstrcpy(pszDirName, L"%miranda_path%\\Plugins");
- mir_wstrcpy(pszFileName, L"UserGuide.chm");
+
+ if (ptszHelpFile == nullptr) {
+ mir_wstrcpy(pszDirName, L"%miranda_path%\\Plugins");
+ mir_wstrcpy(pszFileName, L"UserGuide.chm");
}
- else
- {
- if(!mir_wstrcmp(ptszHelpFile, L""))
- {
+ else {
+ if (!mir_wstrcmp(ptszHelpFile, L"")) {
mir_wstrcpy(pszDirName, L"%miranda_path%\\Plugins");
mir_wstrcpy(pszFileName, L"UserGuide.chm");
}
- else
- {
+ else {
LPTSTR pszDivider = wcsrchr(ptszHelpFile, '\\');
- if (pszDivider == nullptr)
- {
+ if (pszDivider == nullptr) {
mir_wstrcpy(pszDirName, L"");
wcsncpy(pszFileName, ptszHelpFile, mir_wstrlen(ptszHelpFile));
}
- else
- {
+ else {
wcsncpy(pszFileName, pszDivider + 1, mir_wstrlen(ptszHelpFile) - mir_wstrlen(pszDivider) - 1);
pszFileName[mir_wstrlen(ptszHelpFile) - mir_wstrlen(pszDivider) - 1] = 0;
wcsncpy(pszDirName, ptszHelpFile, pszDivider - ptszHelpFile);
@@ -64,21 +67,9 @@ static INT_PTR ShowGuideFile(WPARAM, LPARAM)
return 0;
}
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
-{
- return &pluginInfo;
-}
-
extern "C" __declspec(dllexport) int Load(void)
{
mir_getLP(&pluginInfo);
- CreateServiceFunction("UserGuide/ShowGuide", ShowGuideFile);
CMenuItem mi;
SET_UID(mi, 0x6787c12d, 0xdc85, 0x409d, 0xaa, 0x6c, 0x1f, 0xfe, 0x5f, 0xe8, 0xc1, 0x18);
@@ -88,11 +79,14 @@ extern "C" __declspec(dllexport) int Load(void)
mi.name.w = LPGENW("User Guide");
mi.pszService = "UserGuide/ShowGuide";
Menu_AddMainMenuItem(&mi);
-
+
+ CreateServiceFunction(mi.pszService, ShowGuideFile);
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) int Unload(void)
{
return 0;
-} \ No newline at end of file
+}
diff --git a/plugins/UserGuide/src/stdafx.h b/plugins/UserGuide/src/stdafx.h
index 95ba80f95a..1760206b41 100644
--- a/plugins/UserGuide/src/stdafx.h
+++ b/plugins/UserGuide/src/stdafx.h
@@ -2,7 +2,6 @@
#include <windows.h>
-#define __NO_CMPLUGIN_NEEDED
#include <newpluginapi.h>
#include <m_database.h>
#include <m_langpack.h>
@@ -11,3 +10,10 @@
#include <m_skin.h>
#include "version.h"
+
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(nullptr)
+ {}
+};
diff --git a/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp b/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp
index 347c7c95e3..751d6f8d19 100644
--- a/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp
+++ b/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp
@@ -194,9 +194,9 @@ FIBITMAP* LoadResource(UINT ID, LPTSTR lpType)
{
FIBITMAP *dib = nullptr;
if (lpType) {
- HRSRC hResInfo = FindResource(ghInst,MAKEINTRESOURCE(ID),lpType);
- DWORD ResSize = SizeofResource(ghInst,hResInfo);
- HGLOBAL hRes = LoadResource(ghInst,hResInfo);
+ HRSRC hResInfo = FindResource(g_plugin.getInst(),MAKEINTRESOURCE(ID),lpType);
+ DWORD ResSize = SizeofResource(g_plugin.getInst(),hResInfo);
+ HGLOBAL hRes = LoadResource(g_plugin.getInst(),hResInfo);
BYTE* buffer = (BYTE*)LockResource(hRes);
if (buffer)
{
@@ -214,7 +214,7 @@ FIBITMAP* LoadResource(UINT ID, LPTSTR lpType)
FreeResource(hRes);
}
else {
- HBITMAP hScrBM = (HBITMAP)LoadImage(ghInst,MAKEINTRESOURCE(ID), IMAGE_BITMAP, 0, 0,LR_SHARED);
+ HBITMAP hScrBM = (HBITMAP)LoadImage(g_plugin.getInst(),MAKEINTRESOURCE(ID), IMAGE_BITMAP, 0, 0,LR_SHARED);
if (hScrBM == nullptr)
return dib;
dib = FreeImage_CreateDIBFromHBITMAP(hScrBM);
diff --git a/plugins/UserInfoEx/src/classPsTree.cpp b/plugins/UserInfoEx/src/classPsTree.cpp
index 30fef64b68..c2eeb3d210 100644
--- a/plugins/UserInfoEx/src/classPsTree.cpp
+++ b/plugins/UserInfoEx/src/classPsTree.cpp
@@ -128,7 +128,7 @@ int CPsTree::AddDummyItem(LPCSTR pszGroup)
psh._numPages = _numItems;
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = ghInst;
+ odp.hInstance = g_plugin.getInst();
odp.flags = ODPF_UNICODE;
odp.szTitle.w = mir_utf8decodeW(pszGroup);
@@ -649,7 +649,7 @@ int CPsTree::BeginLabelEdit(HTREEITEM hItem)
rcTree.right - rc.left, rc.bottom - rc.top,
_hWndTree,
nullptr,
- ghInst,
+ g_plugin.getInst(),
nullptr );
if (_hLabelEdit)
{
diff --git a/plugins/UserInfoEx/src/classPsTreeItem.cpp b/plugins/UserInfoEx/src/classPsTreeItem.cpp
index 36f8abde3c..c37c7b31a4 100644
--- a/plugins/UserInfoEx/src/classPsTreeItem.cpp
+++ b/plugins/UserInfoEx/src/classPsTreeItem.cpp
@@ -322,7 +322,7 @@ int CPsTreeItem::Icon(HIMAGELIST hIml, OPTIONSDIALOGPAGE *odp, BYTE bInitIconsOn
// the item to insert brings along an icon?
if (odp->flags & ODPF_ICON) {
// is it uinfoex item?
- if (odp->hInstance == ghInst) {
+ if (odp->hInstance == g_plugin.getInst()) {
// the pszGroup holds the iconfile for items added by uinfoex
sid.defaultFile.w = odp->szGroup.w;
diff --git a/plugins/UserInfoEx/src/commonheaders.cpp b/plugins/UserInfoEx/src/commonheaders.cpp
index 1cfa8ca83b..21c680affe 100644
--- a/plugins/UserInfoEx/src/commonheaders.cpp
+++ b/plugins/UserInfoEx/src/commonheaders.cpp
@@ -22,10 +22,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
// global:
-HINSTANCE ghInst = nullptr;
-CLIST_INTERFACE *pcli = nullptr;
-MGLOBAL myGlobals;
+MGLOBAL myGlobals;
pfnDwmIsCompositionEnabled dwmIsCompositionEnabled;
/**
diff --git a/plugins/UserInfoEx/src/ctrl_button.cpp b/plugins/UserInfoEx/src/ctrl_button.cpp
index 9531c0d7f6..6f88bd700b 100644
--- a/plugins/UserInfoEx/src/ctrl_button.cpp
+++ b/plugins/UserInfoEx/src/ctrl_button.cpp
@@ -619,7 +619,7 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L
void CtrlButtonUnloadModule()
{
- UnregisterClass(UINFOBUTTONCLASS, ghInst);
+ UnregisterClass(UINFOBUTTONCLASS, g_plugin.getInst());
}
void CtrlButtonLoadModule()
diff --git a/plugins/UserInfoEx/src/ctrl_contact.cpp b/plugins/UserInfoEx/src/ctrl_contact.cpp
index 125b7575d3..d252e46ac7 100644
--- a/plugins/UserInfoEx/src/ctrl_contact.cpp
+++ b/plugins/UserInfoEx/src/ctrl_contact.cpp
@@ -693,7 +693,7 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L
cbi.wFlags = 0;
cbi.dwID = 0;
- if (DialogBoxParam(ghInst, MAKEINTRESOURCE(dlgID), GetParent(hwnd), dlgProc, (LPARAM)&cbi) == IDOK) {
+ if (DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(dlgID), GetParent(hwnd), dlgProc, (LPARAM)&cbi) == IDOK) {
MCONTACT hContact = NULL;
SendMessage(hDlgDetails, PSM_GETCONTACT, NULL, (LPARAM)&hContact);
@@ -751,7 +751,7 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L
return 1;
}
- if (DialogBoxParam(ghInst, MAKEINTRESOURCE(dlgID), GetParent(hwnd), dlgProc, (LPARAM)&cbi) == IDOK) {
+ if (DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(dlgID), GetParent(hwnd), dlgProc, (LPARAM)&cbi) == IDOK) {
MCONTACT hContact;
SendMessage(hDlgDetails, PSM_GETCONTACT, NULL, (LPARAM)&hContact);
@@ -1236,7 +1236,7 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L
**/
int CtrlContactUnLoadModule()
{
- UnregisterClass(UINFOCOMBOEXCLASS, ghInst);
+ UnregisterClass(UINFOCOMBOEXCLASS, g_plugin.getInst());
return 0;
}
diff --git a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp
index b5f9e95614..78b01514a9 100644
--- a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp
+++ b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp
@@ -850,7 +850,7 @@ public:
_rcWin.left = _rcWin.right = _rcWin.top = _rcWin.bottom = 0;
LoadFilter();
- _hDlg = CreateDialogParam(ghInst, MAKEINTRESOURCE(IDD_ANNIVERSARY_LIST), nullptr, DlgProc, (LPARAM)this);
+ _hDlg = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ANNIVERSARY_LIST), nullptr, DlgProc, (LPARAM)this);
if (_hDlg)
_mHookExit = HookEventMessage(ME_SYSTEM_PRESHUTDOWN, _hDlg, WM_CLOSE);
else {
diff --git a/plugins/UserInfoEx/src/dlg_msgbox.cpp b/plugins/UserInfoEx/src/dlg_msgbox.cpp
index b97ad0f0e7..137fe5bd7a 100644
--- a/plugins/UserInfoEx/src/dlg_msgbox.cpp
+++ b/plugins/UserInfoEx/src/dlg_msgbox.cpp
@@ -646,9 +646,9 @@ INT_PTR MsgBoxService(WPARAM, LPARAM lParam)
&& myGlobals.PopupActionsExist == 1 // popup support ext stuct?
&& (db_get_dw(NULL, "Popup", "Actions", 0) & 1) // popup++ actions on?
&& db_get_b(NULL, MODNAME, SET_POPUPMSGBOX, DEFVAL_POPUPMSGBOX)) // user likes popups?
- return DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_MSGBOXDUMMI), pMsgBox->hParent, MsgBoxPop, lParam);
+ return DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_MSGBOXDUMMI), pMsgBox->hParent, MsgBoxPop, lParam);
- return DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_MSGBOX), pMsgBox->hParent, MsgBoxProc, lParam);
+ return DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_MSGBOX), pMsgBox->hParent, MsgBoxProc, lParam);
}
return -1;
}
diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp
index 0ad616897e..b0500db926 100644
--- a/plugins/UserInfoEx/src/dlg_propsheet.cpp
+++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp
@@ -329,7 +329,7 @@ static INT_PTR ShowDialog(WPARAM wParam, LPARAM)
qsort(psh._pPages, psh._numPages, sizeof(CPsTreeItem*), (int(*)(const void*, const void*))SortProc);
// create the dialog itself
- if (!CreateDialogParam(ghInst, MAKEINTRESOURCE(IDD_DETAILS), nullptr, DlgProc, (LPARAM)&psh))
+ if (!CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_DETAILS), nullptr, DlgProc, (LPARAM)&psh))
MsgErr(nullptr, LPGENW("Details dialog failed to be created. Returning error is %d."), GetLastError());
return 0;
}
@@ -506,7 +506,7 @@ static int InitDetails(WPARAM wParam, LPARAM lParam)
BYTE bChangeDetailsEnabled = myGlobals.CanChangeDetails && db_get_b(NULL, MODNAME, SET_PROPSHEET_CHANGEMYDETAILS, FALSE);
if (lParam || bChangeDetailsEnabled) {
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = ghInst;
+ odp.hInstance = g_plugin.getInst();
odp.flags = ODPF_ICON | ODPF_UNICODE;
odp.szGroup.w = IcoLib_GetDefaultIconFileName();
@@ -1426,7 +1426,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
}
else {
TreeView_SetInsertMark(pPs->pTree->Window(), NULL, 0);
- SetCursor(LoadCursor(ghInst, MAKEINTRESOURCE(CURSOR_ADDGROUP)));
+ SetCursor(LoadCursor(g_plugin.getInst(), MAKEINTRESOURCE(CURSOR_ADDGROUP)));
}
}
}
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp
index 56c501d28c..fe7bedb5c7 100644
--- a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp
+++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp
@@ -432,6 +432,6 @@ int DlgExImModules_SelectModulesToExport(lpExImParam ExImContact, DB::CEnumList*
dat.ExImContact = ExImContact;
dat.pModules = pModules;
- return (IDOK != DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_EXPORT), hParent, SelectModulesToExport_DlgProc, (LPARAM)&dat));
+ return (IDOK != DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_EXPORT), hParent, SelectModulesToExport_DlgProc, (LPARAM)&dat));
}
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp
index 6e121bc8b9..4b68a0de12 100644
--- a/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp
+++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp
@@ -89,7 +89,7 @@ INT_PTR CALLBACK DlgProcProgress(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPar
CProgress::CProgress()
{
_dwStartTime = GetTickCount();
- _hDlg = CreateDialog(ghInst, MAKEINTRESOURCE(IDD_COPYPROGRESS), nullptr, DlgProcProgress);
+ _hDlg = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_COPYPROGRESS), nullptr, DlgProcProgress);
}
/**
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp
index 0349babe2b..a3c8f29591 100644
--- a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp
+++ b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp
@@ -90,7 +90,7 @@ int CFileXml::Export(lpExImParam ExImContact, LPCSTR pszFileName)
{
DB::CEnumList Modules;
- DWORD result = (DWORD) DialogBox(ghInst,
+ DWORD result = (DWORD) DialogBox(g_plugin.getInst(),
MAKEINTRESOURCE(IDD_EXPORT_DATAHISTORY),
nullptr, DlgProc_DataHistory);
if (LOWORD(result) != IDOK)
diff --git a/plugins/UserInfoEx/src/init.cpp b/plugins/UserInfoEx/src/init.cpp
index 4fa242d8ed..a2191e14d2 100644
--- a/plugins/UserInfoEx/src/init.cpp
+++ b/plugins/UserInfoEx/src/init.cpp
@@ -21,7 +21,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
-static PLUGININFOEX pluginInfo = {
+CLIST_INTERFACE *pcli;
+CMPlugin g_plugin;
+int hLangpack;
+HMODULE hDwmApi;
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+static PLUGININFOEX pluginInfo =
+{
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
@@ -34,9 +42,6 @@ static PLUGININFOEX pluginInfo = {
{0x9c23a24b, 0xe6aa, 0x43c6, {0xb0, 0xb8, 0xd6, 0xc3, 0x6d, 0x2f, 0x7b, 0x57}}
};
-int hLangpack;
-HMODULE hDwmApi;
-
/*
============================================================================================
event hooks
@@ -110,22 +115,10 @@ static int OnShutdown(WPARAM, LPARAM)
return 0;
}
-/*
-============================================================================================
- plugin interface & DllEntrypoint
-============================================================================================
-*/
+//============================================================================================
+// plugin interface
+//============================================================================================
-/**
- * This function is called by Miranda to get some information about this plugin.
- *
- * @return pointer to pluginInfo struct
- **/
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
-{
- myGlobals.mirandaVersion = mirandaVersion;
- return &pluginInfo;
-}
/**
* This function returns the provided interfaces.
@@ -205,16 +198,3 @@ extern "C" int __declspec(dllexport) Load(void)
HookEvent(ME_SYSTEM_SHUTDOWN, OnShutdown);
return 0;
}
-
-/**
- * Windows needs it for loading.
- *
- * @return TRUE
- **/
-BOOL WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID)
-{
- if (fdwReason == DLL_PROCESS_ATTACH)
- ghInst = hinst;
-
- return TRUE;
-}
diff --git a/plugins/UserInfoEx/src/mir_icolib.cpp b/plugins/UserInfoEx/src/mir_icolib.cpp
index 3c3ed95943..1c3aafa8a8 100644
--- a/plugins/UserInfoEx/src/mir_icolib.cpp
+++ b/plugins/UserInfoEx/src/mir_icolib.cpp
@@ -323,7 +323,7 @@ static IconItem common[] =
void IcoLib_LoadModule()
{
- Icon_Register(ghInst, SECT_COMMON, common, 2);
+ Icon_Register(g_plugin.getInst(), SECT_COMMON, common, 2);
LPTSTR szDefaultFile = IcoLib_GetDefaultIconFileName();
IcoLib_CheckIconPackVersion(szDefaultFile);
diff --git a/plugins/UserInfoEx/src/psp_anniversary.cpp b/plugins/UserInfoEx/src/psp_anniversary.cpp
index f4f3b89427..7b9eb45537 100644
--- a/plugins/UserInfoEx/src/psp_anniversary.cpp
+++ b/plugins/UserInfoEx/src/psp_anniversary.cpp
@@ -199,7 +199,7 @@ INT_PTR CALLBACK PSPProcAnniversary(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
case BTN_ADD:
if (HIWORD(wParam) == BN_CLICKED && PtrIsValid(pDateCtrl)) {
MAnnivDate Date;
- if (IDOK == DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_ANNIVERSARY_EDITOR), hDlg, DlgProc_AnniversaryEditor, (LPARAM)&Date)) {
+ if (IDOK == DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ANNIVERSARY_EDITOR), hDlg, DlgProc_AnniversaryEditor, (LPARAM)&Date)) {
SendMessage(GetParent(hDlg), PSM_CHANGED, NULL, NULL);
if (!pDateCtrl->AddDate(Date))
pDateCtrl->SetCurSel(pDateCtrl->NumDates() - 1);
@@ -217,7 +217,7 @@ INT_PTR CALLBACK PSPProcAnniversary(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
if (!pDate)
MsgErr(hDlg, LPGENW("No valid date selected for editing!"));
else if (
- IDOK == DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_ANNIVERSARY_EDITOR), hDlg, DlgProc_AnniversaryEditor, (LPARAM)pDate) &&
+ IDOK == DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ANNIVERSARY_EDITOR), hDlg, DlgProc_AnniversaryEditor, (LPARAM)pDate) &&
(pDate->Flags() & (MAnnivDate::MADF_CHANGED | MAnnivDate::MADF_REMINDER_CHANGED)))
{
SendMessage(GetParent(hDlg), PSM_CHANGED, NULL, NULL);
diff --git a/plugins/UserInfoEx/src/psp_options.cpp b/plugins/UserInfoEx/src/psp_options.cpp
index 8c98ef6c57..5c4355f36a 100644
--- a/plugins/UserInfoEx/src/psp_options.cpp
+++ b/plugins/UserInfoEx/src/psp_options.cpp
@@ -1030,7 +1030,7 @@ static int OnInitOptions(WPARAM wParam, LPARAM)
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = 95400;
- odp.hInstance = ghInst;
+ odp.hInstance = g_plugin.getInst();
odp.szTitle.a = MODULELONGNAME;
odp.szGroup.a = LPGEN("Contacts");
diff --git a/plugins/UserInfoEx/src/psp_profile.cpp b/plugins/UserInfoEx/src/psp_profile.cpp
index 07e2043a1f..85e34efec7 100644
--- a/plugins/UserInfoEx/src/psp_profile.cpp
+++ b/plugins/UserInfoEx/src/psp_profile.cpp
@@ -318,7 +318,7 @@ static HWND ProfileList_BeginLabelEdit(LPLISTCTRL pList, int iItem, int iSubItem
pList->labelEdit.rcCombo.right - (pList->labelEdit.rcCombo.bottom - pList->labelEdit.rcCombo.top), pList->labelEdit.rcCombo.top,
pList->labelEdit.rcCombo.bottom - pList->labelEdit.rcCombo.top,
pList->labelEdit.rcCombo.bottom - pList->labelEdit.rcCombo.top,
- pList->hList, nullptr, ghInst, nullptr);
+ pList->hList, nullptr, g_plugin.getInst(), nullptr);
if (pList->labelEdit.hBtn) {
SetWindowLongPtr(pList->labelEdit.hBtn, GWLP_ID, BTN_EDIT);
pList->labelEdit.rcCombo.right -= pList->labelEdit.rcCombo.bottom - pList->labelEdit.rcCombo.top;
@@ -341,7 +341,7 @@ static HWND ProfileList_BeginLabelEdit(LPLISTCTRL pList, int iItem, int iSubItem
pList->labelEdit.rcCombo.left, pList->labelEdit.rcCombo.top,
pList->labelEdit.rcCombo.right - pList->labelEdit.rcCombo.left,
pList->labelEdit.rcCombo.bottom - pList->labelEdit.rcCombo.top,
- pList->hList, nullptr, ghInst, nullptr);
+ pList->hList, nullptr, g_plugin.getInst(), nullptr);
if (!pList->labelEdit.hEdit)
return nullptr;
SendMessage(pList->labelEdit.hEdit, WM_SETFONT, (WPARAM)(pList->hFont), 0);
@@ -832,7 +832,7 @@ static LRESULT CALLBACK ProfileList_SubclassProc(HWND hwnd, UINT msg, WPARAM wPa
if (textSize.cx > rchWnd.right - rchWnd.left || textSize.cx > rcItem.right - rcItem.left) {
ti.cbSize = sizeof(TOOLINFO);
ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS | TTF_TRANSPARENT;
- ti.hinst = ghInst;
+ ti.hinst = g_plugin.getInst();
ti.hwnd = hwnd;
ti.uId = (UINT_PTR)hwnd;
ti.lpszText = pItem->pszText[hi.iSubItem];
@@ -933,7 +933,7 @@ static LRESULT CALLBACK ProfileList_SubclassProc(HWND hwnd, UINT msg, WPARAM wPa
pList->labelEdit.dropDown.hDrop = CreateWindowEx(0, L"LISTBOX", nullptr,
WS_CHILD | WS_BORDER | WS_VSCROLL | LBS_COMBOBOX | LBS_HASSTRINGS,
rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top,
- hwnd, nullptr, ghInst, nullptr);
+ hwnd, nullptr, g_plugin.getInst(), nullptr);
if (!pList->labelEdit.dropDown.hDrop)
return FALSE;
SetUserData(pList->labelEdit.dropDown.hDrop, pList);
@@ -1071,7 +1071,7 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR
// initiate the tooltips
pList->hTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, nullptr, WS_POPUP | TTS_BALLOON | TTS_NOPREFIX | TTS_ALWAYSTIP,
- CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hList, nullptr, ghInst, nullptr);
+ CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hList, nullptr, g_plugin.getInst(), nullptr);
if (pList->hTip) {
SetWindowPos(pList->hTip, HWND_TOPMOST, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
@@ -1079,7 +1079,7 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR
memset(&ti, 0, sizeof(TOOLINFO));
ti.cbSize = sizeof(TOOLINFO);
ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS | TTF_TRANSPARENT;
- ti.hinst = ghInst;
+ ti.hinst = g_plugin.getInst();
ti.hwnd = hList;
ti.uId = (UINT_PTR)hList;
SendMessage(pList->hTip, TTM_ADDTOOL, NULL, (LPARAM)&ti);
diff --git a/plugins/UserInfoEx/src/stdafx.h b/plugins/UserInfoEx/src/stdafx.h
index c34ad85bde..ce7655e304 100644
--- a/plugins/UserInfoEx/src/stdafx.h
+++ b/plugins/UserInfoEx/src/stdafx.h
@@ -48,7 +48,6 @@ using namespace std;
* Miranda NG SDK includes and macros
***********************************************************************************************************/
-#define __NO_CMPLUGIN_NEEDED
#include <newpluginapi.h>
#include <m_button.h>
#include <m_clistint.h>
@@ -159,18 +158,23 @@ unsigned int hashSettingW_M2(const char * key); //new Murma2 hash
* UserInfoEx global variables
***********************************************************************************************************/
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODNAME)
+ {}
+};
+
typedef struct _MGLOBAL
{
- DWORD mirandaVersion; // mirandaVersion
- BYTE CanChangeDetails : 1; // is service to upload own contact information for icq present?
- BYTE TzIndexExist : 1; // Win Reg has Timzone Index Info
- BYTE PopupActionsExist : 1; // Popup++ or MS_POPUP_REGISTERACTIONS exist
- BYTE ShowPropsheetColours : 1; // cached SET_PROPSHEET_SHOWCOLOURS database value
- BYTE WantAeroAdaption : 1; // reserved for later use
+ BYTE CanChangeDetails : 1; // is service to upload own contact information for icq present?
+ BYTE TzIndexExist : 1; // Win Reg has Timzone Index Info
+ BYTE PopupActionsExist : 1; // Popup++ or MS_POPUP_REGISTERACTIONS exist
+ BYTE ShowPropsheetColours : 1; // cached SET_PROPSHEET_SHOWCOLOURS database value
+ BYTE WantAeroAdaption : 1; // reserved for later use
} MGLOBAL, *LPMGLOBAL;
-extern HINSTANCE ghInst;
-extern MGLOBAL myGlobals;
+extern MGLOBAL myGlobals;
extern int nCountriesCount;
extern struct CountryListEntry *countries;
diff --git a/plugins/UserInfoEx/src/svc_constants.h b/plugins/UserInfoEx/src/svc_constants.h
index 453693380b..60dbc10f7f 100644
--- a/plugins/UserInfoEx/src/svc_constants.h
+++ b/plugins/UserInfoEx/src/svc_constants.h
@@ -22,151 +22,153 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _SVC_CONSTANTS_INCLUDED_
#define _SVC_CONSTANTS_INCLUDED_
-#define MODULELONGNAME LPGEN("Extended user info")
-#define USERINFO "UserInfo"
-#define MODNAME "UserInfoEx"
-#define MODNAMEFLAGS "Flags"
-
-#define MODULELONGNAMET _T(MODULELONGNAME)
-#define MODNAMET _T(MODNAME)
-
-#define MAXDATASIZE 1024 // maximum character count of most static, temporary, ...., strings
-#define MAXCATLEN 64 // maximum character count for a category string (phone, email, interest, ...)
-#define MAXSETTING 255 // maximum character count for a setting string
-#define MAXNAME 260 // maximum character count for a username
-#define MAXUID 260 // maximum character count for a uin
+#define MODNAME "UserInfoEx"
+#define MODNAMET _T(MODNAME)
+#define USERINFO "UserInfo"
+#define MODNAMEFLAGS "Flags"
+#define MODULELONGNAME LPGEN("Extended user info")
+#define MODULELONGNAMET _T(MODULELONGNAME)
+
+#define MAXDATASIZE 1024 // maximum character count of most static, temporary, ...., strings
+#define MAXCATLEN 64 // maximum character count for a category string (phone, email, interest, ...)
+#define MAXSETTING 255 // maximum character count for a setting string
+#define MAXNAME 260 // maximum character count for a username
+#define MAXUID 260 // maximum character count for a uin
// most important modules
-#define MOD_MBIRTHDAY "mBirthday"
-#define MOD_CLIST "CList"
+#define MOD_MBIRTHDAY "mBirthday"
+#define MOD_CLIST "CList"
// database settings (propertysheet)
-#define SET_PROPSHEET_PCBIREADONLY "PBCIReadOnly"
-#define SET_PROPSHEET_READONLYLABEL "TILReadonly"
-#define SET_PROPSHEET_AEROADAPTION "AeroAdaption"
-#define SET_PROPSHEET_SHOWCOLOURS "ShowColours"
-#define SET_PROPSHEET_CLRNORMAL "colourNormal"
-#define SET_PROPSHEET_CLRCUSTOM "colourUser"
-#define SET_PROPSHEET_CLRBOTH "colourBoth"
-#define SET_PROPSHEET_CLRCHANGED "colourChanged"
-#define SET_PROPSHEET_CLRMETA "colourMeta"
-#define SET_PROPSHEET_SAVEVCARD "vCardOnExit"
-#define SET_PROPSHEET_GROUPS "TreeGroups"
-#define SET_PROPSHEET_SORTITEMS "TreeSortItems"
-#define SET_PROPSHEET_CHANGEMYDETAILS "ChangeMyDetails"
-#define SET_ABOUT_ACTIVEWINDOW "AboutActiveWin"
-#define SET_MI_MAIN "miMenu"
-#define SET_MI_CONTACT "miContact"
-#define SET_MI_GROUP "miGroup"
-#define SET_MI_SUBGROUP "miSubGroup"
-#define SET_MI_STATUS "miStatus"
-#define SET_MI_ACCOUNT "miAccount"
-
-#define SET_EXTENDED_EMAILSERVICE "emailEx"
-#define SET_CLIST_EXTRAICON_GENDER "GenderColumn"
-#define SET_CLIST_EXTRAICON_GENDER2 "cliGender"
-#define SET_CLIST_EXTRAICON_COUNTRY "CountryColumn"
-#define SET_CLIST_EXTRAICON_HOMEPAGE "cliHomepage"
-#define SET_CLIST_EXTRAICON_EMAIL "cliEmail"
-#define SET_CLIST_EXTRAICON_PHONE "cliPhone"
-#define SET_OPT_AUTOTIMEZONE "AutoTimezone"
-#define SET_ZODIAC_AVATARS "ZodicAvatars"
-#define SET_META_SCAN "MetaScan"
-// database settings (general psp)
-#define SET_ME_PASSWORD "Password"
-#define SET_CONTACT_TITLE "Title"
-#define SET_CONTACT_FIRSTNAME "FirstName"
-#define SET_CONTACT_SECONDNAME "SecondName"
-#define SET_CONTACT_LASTNAME "LastName"
-#define SET_CONTACT_FIRSTLASTNAME "FullName"
-#define SET_CONTACT_PREFIX "Prefix"
-#define SET_CONTACT_NICK "Nick"
-#define SET_CONTACT_MYHANDLE "MyHandle"
-#define SET_CONTACT_STREET "Street"
-#define SET_CONTACT_ZIP "Zip"
-#define SET_CONTACT_CITY "City"
-#define SET_CONTACT_STATE "State"
-#define SET_CONTACT_COUNTRY "Country"
-#define SET_CONTACT_GENDER "Gender"
+#define SET_PROPSHEET_PCBIREADONLY "PBCIReadOnly"
+#define SET_PROPSHEET_READONLYLABEL "TILReadonly"
+#define SET_PROPSHEET_AEROADAPTION "AeroAdaption"
+#define SET_PROPSHEET_SHOWCOLOURS "ShowColours"
+#define SET_PROPSHEET_CLRNORMAL "colourNormal"
+#define SET_PROPSHEET_CLRCUSTOM "colourUser"
+#define SET_PROPSHEET_CLRBOTH "colourBoth"
+#define SET_PROPSHEET_CLRCHANGED "colourChanged"
+#define SET_PROPSHEET_CLRMETA "colourMeta"
+#define SET_PROPSHEET_SAVEVCARD "vCardOnExit"
+#define SET_PROPSHEET_GROUPS "TreeGroups"
+#define SET_PROPSHEET_SORTITEMS "TreeSortItems"
+#define SET_PROPSHEET_CHANGEMYDETAILS "ChangeMyDetails"
+#define SET_ABOUT_ACTIVEWINDOW "AboutActiveWin"
+#define SET_MI_MAIN "miMenu"
+#define SET_MI_CONTACT "miContact"
+#define SET_MI_GROUP "miGroup"
+#define SET_MI_SUBGROUP "miSubGroup"
+#define SET_MI_STATUS "miStatus"
+#define SET_MI_ACCOUNT "miAccount"
+
+#define SET_EXTENDED_EMAILSERVICE "emailEx"
+#define SET_CLIST_EXTRAICON_GENDER "GenderColumn"
+#define SET_CLIST_EXTRAICON_GENDER2 "cliGender"
+#define SET_CLIST_EXTRAICON_COUNTRY "CountryColumn"
+#define SET_CLIST_EXTRAICON_HOMEPAGE "cliHomepage"
+#define SET_CLIST_EXTRAICON_EMAIL "cliEmail"
+#define SET_CLIST_EXTRAICON_PHONE "cliPhone"
+#define SET_OPT_AUTOTIMEZONE "AutoTimezone"
+#define SET_ZODIAC_AVATARS "ZodicAvatars"
+#define SET_META_SCAN "MetaScan"
+
+// database settings (general psp)
+#define SET_ME_PASSWORD "Password"
+#define SET_CONTACT_TITLE "Title"
+#define SET_CONTACT_FIRSTNAME "FirstName"
+#define SET_CONTACT_SECONDNAME "SecondName"
+#define SET_CONTACT_LASTNAME "LastName"
+#define SET_CONTACT_FIRSTLASTNAME "FullName"
+#define SET_CONTACT_PREFIX "Prefix"
+#define SET_CONTACT_NICK "Nick"
+#define SET_CONTACT_MYHANDLE "MyHandle"
+#define SET_CONTACT_STREET "Street"
+#define SET_CONTACT_ZIP "Zip"
+#define SET_CONTACT_CITY "City"
+#define SET_CONTACT_STATE "State"
+#define SET_CONTACT_COUNTRY "Country"
+#define SET_CONTACT_GENDER "Gender"
// database settings (advanced psp)
-#define SET_CONTACT_ORIGIN_STREET "OriginStreet"
-#define SET_CONTACT_ORIGIN_ZIP "OriginZip"
-#define SET_CONTACT_ORIGIN_CITY "OriginCity"
-#define SET_CONTACT_ORIGIN_STATE "OriginState"
-#define SET_CONTACT_ORIGIN_COUNTRY "OriginCountry"
-#define SET_CONTACT_LANG1 "Language1"
-#define SET_CONTACT_LANG2 "Language2"
-#define SET_CONTACT_LANG3 "Language3"
-#define SET_CONTACT_MARITAL "MaritalStatus"
-#define SET_CONTACT_PARTNER "Partner"
-#define SET_CONTACT_ANNIVERSARY "Anniv"
-#define SET_CONTACT_AGE "Age"
-#define SET_CONTACT_TIMEZONE "Timezone"
-#define SET_CONTACT_TIMEZONENAME "TzName"
-#define SET_CONTACT_TIMEZONEINDEX "TzIndex"
-#define SET_CONTACT_BIRTH "Birth"
-#define SET_CONTACT_BIRTHDAY "BirthDay"
-#define SET_CONTACT_BIRTHMONTH "BirthMonth"
-#define SET_CONTACT_BIRTHYEAR "BirthYear"
-#define SET_CONTACT_DOBD "DOBd"
-#define SET_CONTACT_DOBM "DOBm"
-#define SET_CONTACT_DOBY "DOBy"
+#define SET_CONTACT_ORIGIN_STREET "OriginStreet"
+#define SET_CONTACT_ORIGIN_ZIP "OriginZip"
+#define SET_CONTACT_ORIGIN_CITY "OriginCity"
+#define SET_CONTACT_ORIGIN_STATE "OriginState"
+#define SET_CONTACT_ORIGIN_COUNTRY "OriginCountry"
+#define SET_CONTACT_LANG1 "Language1"
+#define SET_CONTACT_LANG2 "Language2"
+#define SET_CONTACT_LANG3 "Language3"
+#define SET_CONTACT_MARITAL "MaritalStatus"
+#define SET_CONTACT_PARTNER "Partner"
+#define SET_CONTACT_ANNIVERSARY "Anniv"
+#define SET_CONTACT_AGE "Age"
+#define SET_CONTACT_TIMEZONE "Timezone"
+#define SET_CONTACT_TIMEZONENAME "TzName"
+#define SET_CONTACT_TIMEZONEINDEX "TzIndex"
+#define SET_CONTACT_BIRTH "Birth"
+#define SET_CONTACT_BIRTHDAY "BirthDay"
+#define SET_CONTACT_BIRTHMONTH "BirthMonth"
+#define SET_CONTACT_BIRTHYEAR "BirthYear"
+#define SET_CONTACT_DOBD "DOBd"
+#define SET_CONTACT_DOBM "DOBm"
+#define SET_CONTACT_DOBY "DOBy"
+
// database settings (company psp)
-#define SET_CONTACT_COMPANY_POSITION "CompanyPosition"
-#define SET_CONTACT_COMPANY_OCCUPATION "CompanyOccupation"
-#define SET_CONTACT_COMPANY_SUPERIOR "CompanySuperior"
-#define SET_CONTACT_COMPANY_ASSISTENT "CompanyAssistent"
-#define SET_CONTACT_COMPANY "Company"
-#define SET_CONTACT_COMPANY_DEPARTMENT "CompanyDepartment"
-#define SET_CONTACT_COMPANY_OFFICE "CompanyOffice"
-#define SET_CONTACT_COMPANY_STREET "CompanyStreet"
-#define SET_CONTACT_COMPANY_ZIP "CompanyZip"
-#define SET_CONTACT_COMPANY_CITY "CompanyCity"
-#define SET_CONTACT_COMPANY_STATE "CompanyState"
-#define SET_CONTACT_COMPANY_COUNTRY "CompanyCountry"
-#define SET_CONTACT_COMPANY_HOMEPAGE "CompanyHomepage"
-// database settings (about psp)
-#define SET_CONTACT_ABOUT "About"
-#define SET_CONTACT_MYNOTES "MyNotes"
-// database settings (... psp)
-#define SET_CONTACT_PHONE "Phone"
-#define SET_CONTACT_FAX "Fax"
-#define SET_CONTACT_CELLULAR "Cellular"
-#define SET_CONTACT_EMAIL "e-mail"
-#define SET_CONTACT_EMAIL0 "e-mail0"
-#define SET_CONTACT_EMAIL1 "e-mail1"
-#define SET_CONTACT_HOMEPAGE "Homepage"
-#define SET_CONTACT_COMPANY_PHONE "CompanyPhone"
-#define SET_CONTACT_COMPANY_FAX "CompanyFax"
-#define SET_CONTACT_COMPANY_CELLULAR "CompanyCellular"
-#define SET_CONTACT_COMPANY_EMAIL "Companye-mail"
-#define SET_CONTACT_COMPANY_EMAIL0 "Companye-mail0"
-#define SET_CONTACT_COMPANY_EMAIL1 "Companye-mail1"
-
-#define SET_CONTACT_MYPHONE_VAL "MyPhone%d"
-#define SET_CONTACT_MYPHONE_CAT "MyPhone%dCat"
-#define SET_CONTACT_COMPANY_MYPHONE_VAL "MyCompanyPhone%d"
-#define SET_CONTACT_COMPANY_MYPHONE_CAT "MyCompanyPhone%dCat"
-#define SET_CONTACT_MYEMAIL_VAL "Mye-mail%d"
-#define SET_CONTACT_MYEMAIL_CAT "Mye-mail%dCat"
-#define SET_CONTACT_COMPANY_MYEMAIL_VAL "MyCompanye-mail%d"
-#define SET_CONTACT_COMPANY_MYEMAIL_CAT "MyCompanye-mail%dCat"
-
-#define SET_CONTACT_ADDEDTIME "ContactAddTime"
+#define SET_CONTACT_COMPANY_POSITION "CompanyPosition"
+#define SET_CONTACT_COMPANY_OCCUPATION "CompanyOccupation"
+#define SET_CONTACT_COMPANY_SUPERIOR "CompanySuperior"
+#define SET_CONTACT_COMPANY_ASSISTENT "CompanyAssistent"
+#define SET_CONTACT_COMPANY "Company"
+#define SET_CONTACT_COMPANY_DEPARTMENT "CompanyDepartment"
+#define SET_CONTACT_COMPANY_OFFICE "CompanyOffice"
+#define SET_CONTACT_COMPANY_STREET "CompanyStreet"
+#define SET_CONTACT_COMPANY_ZIP "CompanyZip"
+#define SET_CONTACT_COMPANY_CITY "CompanyCity"
+#define SET_CONTACT_COMPANY_STATE "CompanyState"
+#define SET_CONTACT_COMPANY_COUNTRY "CompanyCountry"
+#define SET_CONTACT_COMPANY_HOMEPAGE "CompanyHomepage"
+// database settings (about psp)
+#define SET_CONTACT_ABOUT "About"
+#define SET_CONTACT_MYNOTES "MyNotes"
+// database settings (... psp)
+#define SET_CONTACT_PHONE "Phone"
+#define SET_CONTACT_FAX "Fax"
+#define SET_CONTACT_CELLULAR "Cellular"
+#define SET_CONTACT_EMAIL "e-mail"
+#define SET_CONTACT_EMAIL0 "e-mail0"
+#define SET_CONTACT_EMAIL1 "e-mail1"
+#define SET_CONTACT_HOMEPAGE "Homepage"
+#define SET_CONTACT_COMPANY_PHONE "CompanyPhone"
+#define SET_CONTACT_COMPANY_FAX "CompanyFax"
+#define SET_CONTACT_COMPANY_CELLULAR "CompanyCellular"
+#define SET_CONTACT_COMPANY_EMAIL "Companye-mail"
+#define SET_CONTACT_COMPANY_EMAIL0 "Companye-mail0"
+#define SET_CONTACT_COMPANY_EMAIL1 "Companye-mail1"
+
+#define SET_CONTACT_MYPHONE_VAL "MyPhone%d"
+#define SET_CONTACT_MYPHONE_CAT "MyPhone%dCat"
+#define SET_CONTACT_COMPANY_MYPHONE_VAL "MyCompanyPhone%d"
+#define SET_CONTACT_COMPANY_MYPHONE_CAT "MyCompanyPhone%dCat"
+#define SET_CONTACT_MYEMAIL_VAL "Mye-mail%d"
+#define SET_CONTACT_MYEMAIL_CAT "Mye-mail%dCat"
+#define SET_CONTACT_COMPANY_MYEMAIL_VAL "MyCompanye-mail%d"
+#define SET_CONTACT_COMPANY_MYEMAIL_CAT "MyCompanye-mail%dCat"
+
+#define SET_CONTACT_ADDEDTIME "ContactAddTime"
+
// default values for some of the options
-#define DEFVAL_GETCONTACTINFO_ENABLED 1
+#define DEFVAL_GETCONTACTINFO_ENABLED 1
-#define DEFVAL_CLIST_EXTRAICON_GENDER 2
-#define DEFVAL_CLIST_EXTRAICON_COUNTRY 3
+#define DEFVAL_CLIST_EXTRAICON_GENDER 2
+#define DEFVAL_CLIST_EXTRAICON_COUNTRY 3
#define DEFVAL_CLIST_EXTRAICON_HOMEPAGE 1
-#define DEFVAL_CLIST_EXTRAICON_EMAIL 1
-#define DEFVAL_CLIST_EXTRAICON_PHONE 1
+#define DEFVAL_CLIST_EXTRAICON_EMAIL 1
+#define DEFVAL_CLIST_EXTRAICON_PHONE 1
typedef struct CIDList
{
- int nID;
- LPCSTR pszText;
- LPTSTR ptszTranslated;
+ int nID;
+ LPCSTR pszText;
+ LPTSTR ptszTranslated;
} IDSTRLIST, *LPIDSTRLIST;
@@ -182,4 +184,4 @@ INT_PTR GetNamePrefixList(LPUINT pListSize, LPIDSTRLIST *pList);
void SvcConstantsLoadModule(void);
void SvcConstantsUnloadModule(void);
-#endif /* _SVC_CONSTANTS_INCLUDED_ */ \ No newline at end of file
+#endif /* _SVC_CONSTANTS_INCLUDED_ */
diff --git a/plugins/UserInfoEx/src/svc_refreshci.cpp b/plugins/UserInfoEx/src/svc_refreshci.cpp
index c1a9ac3bf7..986e2bfa52 100644
--- a/plugins/UserInfoEx/src/svc_refreshci.cpp
+++ b/plugins/UserInfoEx/src/svc_refreshci.cpp
@@ -281,7 +281,7 @@ public:
virtual HWND Create(LPCTSTR szTitle, PUpdCallback pFnCallBack)
{
_pFnCallBack = pFnCallBack;
- _hWnd = CreateDialogParam(ghInst,
+ _hWnd = CreateDialogParam(g_plugin.getInst(),
MAKEINTRESOURCE(IDD_REFRESHDETAILS),
nullptr,
CDlgUpdProgress::WndProc,
diff --git a/plugins/Variables/src/help.cpp b/plugins/Variables/src/help.cpp
index 59fd3b5170..3e1d5678bd 100644
--- a/plugins/Variables/src/help.cpp
+++ b/plugins/Variables/src/help.cpp
@@ -29,8 +29,6 @@ struct HELPDLGDATA
static INT_PTR CALLBACK inputDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam);
-extern HINSTANCE hInst;
-
extern HCURSOR hCurSplitNS;
static HWND hwndHelpDialog = nullptr;
@@ -73,7 +71,7 @@ static INT_PTR CALLBACK extratextDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPA
case WM_SIZE:
if (!IsIconic( hwndDlg )) {
- Utils_ResizeDialog(hwndDlg, hInst, MAKEINTRESOURCEA(IDD_EXTRATEXT_DIALOG), defaultHelpDialogResize);
+ Utils_ResizeDialog(hwndDlg, g_plugin.getInst(), MAKEINTRESOURCEA(IDD_EXTRATEXT_DIALOG), defaultHelpDialogResize);
SendMessage(hwndDlg, WM_MOVE, 0, 0);
}
break;
@@ -159,7 +157,7 @@ static INT_PTR CALLBACK clistDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM
case WM_SIZE:
if (!IsIconic(hwndDlg)) {
- Utils_ResizeDialog(hwndDlg, hInst, MAKEINTRESOURCEA(IDD_CLIST_DIALOG), clistDialogResize);
+ Utils_ResizeDialog(hwndDlg, g_plugin.getInst(), MAKEINTRESOURCEA(IDD_CLIST_DIALOG), clistDialogResize);
SendMessage(hwndDlg, WM_MOVE, 0, 0);
}
break;
@@ -492,7 +490,7 @@ static INT_PTR CALLBACK tokenHelpDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
case WM_SIZE:
if (!IsIconic(hwndDlg)) {
- Utils_ResizeDialog(hwndDlg, hInst, MAKEINTRESOURCEA(IDD_TOKENS_DIALOG), defaultHelpDialogResize);
+ Utils_ResizeDialog(hwndDlg, g_plugin.getInst(), MAKEINTRESOURCEA(IDD_TOKENS_DIALOG), defaultHelpDialogResize);
SendMessage(hwndDlg, WM_MOVE, 0, 0);
}
break;
@@ -658,7 +656,7 @@ static INT_PTR CALLBACK inputDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM
case WM_SIZE:
if (!IsIconic(hwndDlg))
- Utils_ResizeDialog(hwndDlg, hInst, MAKEINTRESOURCEA(IDD_INPUT_DIALOG), inputDialogResize, (LPARAM)dat);
+ Utils_ResizeDialog(hwndDlg, g_plugin.getInst(), MAKEINTRESOURCEA(IDD_INPUT_DIALOG), inputDialogResize, (LPARAM)dat);
SendMessage(hwndDlg, WM_MOVE, 0, 0);
break;
@@ -740,7 +738,7 @@ static INT_PTR CALLBACK helpInfoDlgProc(HWND hwndDlg,UINT msg,WPARAM,LPARAM)
case WM_SIZE:
if (!IsIconic( hwndDlg )) {
- Utils_ResizeDialog(hwndDlg, hInst, MAKEINTRESOURCEA(IDD_HELPINFO_DIALOG), defaultHelpDialogResize);
+ Utils_ResizeDialog(hwndDlg, g_plugin.getInst(), MAKEINTRESOURCEA(IDD_HELPINFO_DIALOG), defaultHelpDialogResize);
SendMessage(hwndDlg, WM_MOVE, 0, 0);
}
break;
@@ -786,7 +784,7 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l
// token tab
tci.mask = TCIF_TEXT | TCIF_PARAM;
tci.pszText = TranslateT("Tokens");
- hPage = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_TOKENS_DIALOG), hwndDlg, tokenHelpDlgProc, (LPARAM)GetParent(hwndDlg));
+ hPage = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_TOKENS_DIALOG), hwndDlg, tokenHelpDlgProc, (LPARAM)GetParent(hwndDlg));
EnableThemeDialogTexture(hPage, ETDT_ENABLETAB);
tci.lParam = (LPARAM)hPage;
@@ -799,7 +797,7 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l
// input tab
tci.mask = TCIF_TEXT | TCIF_PARAM;
tci.pszText = TranslateT("Input");
- dat->hwndInputDlg = hPage = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_INPUT_DIALOG), hwndDlg, inputDlgProc, (LPARAM)GetParent(hwndDlg));
+ dat->hwndInputDlg = hPage = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_INPUT_DIALOG), hwndDlg, inputDlgProc, (LPARAM)GetParent(hwndDlg));
EnableThemeDialogTexture(hPage, ETDT_ENABLETAB);
tci.lParam = (LPARAM)hPage;
@@ -833,7 +831,7 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l
if ((dat->vhs->flags&VHF_SUBJECT) ||
((dat->vhs->flags&VHF_INPUT) && (((dat->vhs->fi != nullptr) && (dat->vhs->fi->hContact != NULL)) || (dat->vhs->flags&VHF_SETLASTSUBJECT)))) {
// subject window is created, but not necessarily shown
- dat->hwndSubjectDlg = hPage = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CLIST_DIALOG), hwndDlg, clistDlgProc, (LPARAM)GetParent(hwndDlg));
+ dat->hwndSubjectDlg = hPage = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CLIST_DIALOG), hwndDlg, clistDlgProc, (LPARAM)GetParent(hwndDlg));
EnableThemeDialogTexture(hPage, ETDT_ENABLETAB);
MoveWindow(hPage, (rcTabs.left - rcParent.left), (rcTabs.top - rcParent.top), (rcTabs.right - rcTabs.left) - 2 * iFrameX, (rcTabs.bottom - rcTabs.top) - 2 * iFrameY, TRUE);
@@ -856,7 +854,7 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l
if ((dat->vhs->flags&VHF_EXTRATEXT) ||
((dat->vhs->flags&VHF_INPUT) && (dat->vhs->fi != nullptr) && (dat->vhs->fi->tszExtraText != nullptr))) {
// extratext window is created, but not necessarily shown
- dat->hwndExtraTextDlg = hPage = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_EXTRATEXT_DIALOG), hwndDlg, extratextDlgProc, (LPARAM)GetParent(hwndDlg));
+ dat->hwndExtraTextDlg = hPage = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_EXTRATEXT_DIALOG), hwndDlg, extratextDlgProc, (LPARAM)GetParent(hwndDlg));
EnableThemeDialogTexture(hPage, ETDT_ENABLETAB);
MoveWindow(hPage, (rcTabs.left - rcParent.left), (rcTabs.top - rcParent.top), (rcTabs.right - rcTabs.left) - 2 * iFrameX, (rcTabs.bottom - rcTabs.top) - 2 * iFrameY, TRUE);
@@ -885,7 +883,7 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l
// helpinfo tab
tci.mask = TCIF_TEXT | TCIF_PARAM;
tci.pszText = TranslateT("Help");
- hPage = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_HELPINFO_DIALOG), hwndDlg, helpInfoDlgProc, (LPARAM)GetParent(hwndDlg));
+ hPage = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_HELPINFO_DIALOG), hwndDlg, helpInfoDlgProc, (LPARAM)GetParent(hwndDlg));
EnableThemeDialogTexture(hPage, ETDT_ENABLETAB);
tci.lParam = (LPARAM)hPage;
@@ -1039,7 +1037,7 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l
case WM_SIZE:
if (!IsIconic(hwndDlg)) {
- Utils_ResizeDialog(hwndDlg, hInst, MAKEINTRESOURCEA(IDD_HELP_DIALOG), helpDialogResize);
+ Utils_ResizeDialog(hwndDlg, g_plugin.getInst(), MAKEINTRESOURCEA(IDD_HELP_DIALOG), helpDialogResize);
SendMessage(hwndDlg, WM_MOVE, 0, 0);
RECT rcTabs, rcParent;
@@ -1126,9 +1124,9 @@ INT_PTR showHelpExService(WPARAM wParam, LPARAM lParam)
iFrameY = 3 * GetSystemMetrics(SM_CYSIZEFRAME);
if (wParam)
- DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_HELP_DIALOG), (HWND)wParam, helpDlgProc, (LPARAM)lParam);
+ DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_HELP_DIALOG), (HWND)wParam, helpDlgProc, (LPARAM)lParam);
else
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_HELP_DIALOG), nullptr, helpDlgProc, (LPARAM)lParam);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_HELP_DIALOG), nullptr, helpDlgProc, (LPARAM)lParam);
return 0;
}
diff --git a/plugins/Variables/src/main.cpp b/plugins/Variables/src/main.cpp
index b7195bcc6d..551871a485 100644
--- a/plugins/Variables/src/main.cpp
+++ b/plugins/Variables/src/main.cpp
@@ -16,17 +16,12 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
#include "stdafx.h"
-HINSTANCE hInst;
+CMPlugin g_plugin;
int hLangpack = 0;
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
/////////////////////////////////////////////////////////////////////////////////////////
// MirandaPluginInfoEx - returns the extended information about a plugin
@@ -41,7 +36,7 @@ PLUGININFOEX pluginInfoEx =
__AUTHORWEB,
UNICODE_AWARE,
// {59B0036E-5403-422E-883B-C9AAF425682B}
- {0x59b0036e, 0x5403, 0x422e, {0x88, 0x3b, 0xc9, 0xaa, 0xf4, 0x25, 0x68, 0x2b}}
+ { 0x59b0036e, 0x5403, 0x422e, {0x88, 0x3b, 0xc9, 0xaa, 0xf4, 0x25, 0x68, 0x2b }}
};
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
diff --git a/plugins/Variables/src/options.cpp b/plugins/Variables/src/options.cpp
index 48e04098f9..1087b6f250 100644
--- a/plugins/Variables/src/options.cpp
+++ b/plugins/Variables/src/options.cpp
@@ -134,7 +134,7 @@ int OptionsInit(WPARAM wParam, LPARAM)
odp.position = 150000000;
odp.szGroup.a = LPGEN("Services");
odp.szTitle.a = LPGEN("Variables");
- odp.hInstance = hInst;
+ odp.hInstance = g_plugin.getInst();
odp.pfnDlgProc = SetOptsDlgProc;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTS_DIALOG);
Options_AddPage(wParam, &odp);
diff --git a/plugins/Variables/src/stdafx.h b/plugins/Variables/src/stdafx.h
index 63f5205a01..fa651b6014 100644
--- a/plugins/Variables/src/stdafx.h
+++ b/plugins/Variables/src/stdafx.h
@@ -32,7 +32,6 @@
#include <pdh.h>
#include <pdhmsg.h>
-#define __NO_CMPLUGIN_NEEDED
#include <win2k.h>
#include <newpluginapi.h>
#include <m_langpack.h>
@@ -71,6 +70,13 @@
#define MODULENAME "Variables"
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODULENAME)
+ {}
+};
+
#define SETTING_STARTUPTEXT "StartupText"
#define SETTING_STRIPCRLF "StripCRLF"
#define SETTING_STRIPWS "StripWS"
@@ -149,8 +155,7 @@ struct ParseOptions {
BOOL bStripAll;
};
-extern HINSTANCE hInst;
-extern struct ParseOptions gParseOpts;
+extern ParseOptions gParseOpts;
extern int hLangpack;
// variables.c
diff --git a/plugins/Variables/src/variables.cpp b/plugins/Variables/src/variables.cpp
index 3ba1ae1ab3..fc7ea14a6e 100644
--- a/plugins/Variables/src/variables.cpp
+++ b/plugins/Variables/src/variables.cpp
@@ -422,7 +422,7 @@ int LoadVarModule()
CreateServiceFunction(MS_VARS_SHOWHELP, showHelpService);
CreateServiceFunction(MS_VARS_SHOWHELPEX, showHelpExService);
- Icon_Register(hInst, LPGEN("Variables"), &icon, 1);
+ Icon_Register(g_plugin.getInst(), LPGEN("Variables"), &icon, 1);
hIconsChangedHook = HookEvent(ME_SKIN2_ICONSCHANGED, iconsChanged);