summaryrefslogtreecommitdiff
path: root/plugins/Variables/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Variables/src')
-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
5 files changed, 26 insertions, 28 deletions
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);