summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorKirill Volinsky <Mataes2007@gmail.com>2018-05-16 17:06:38 +0300
committerKirill Volinsky <Mataes2007@gmail.com>2018-05-16 17:06:38 +0300
commit0c2b7724eba7cd5e35cf8c3b58b1f1a42fa1c288 (patch)
tree2f45df3033c5fd888215c5938b960524c5d3497b /plugins
parenta6575dc0578e825a830d062319397a3f841f6b54 (diff)
Boltun: cmplugin adaptation
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Boltun/src/boltun.cpp18
-rw-r--r--plugins/Boltun/src/stdafx.h9
2 files changed, 13 insertions, 14 deletions
diff --git a/plugins/Boltun/src/boltun.cpp b/plugins/Boltun/src/boltun.cpp
index 09e2949a95..00188261de 100644
--- a/plugins/Boltun/src/boltun.cpp
+++ b/plugins/Boltun/src/boltun.cpp
@@ -20,6 +20,7 @@
#include "stdafx.h"
+CMPlugin g_plugin;
int hLangpack;
TalkBot* bot = nullptr;
@@ -27,7 +28,6 @@ TalkBot* bot = nullptr;
#define MAX_WARN_TEXT 1024
#define MAX_MIND_FILE 1024
-HINSTANCE hInst;
BOOL blInit = FALSE;
UINT pTimer = 0;
wchar_t tszPath[MAX_PATH];
@@ -115,17 +115,17 @@ static bool LoadMind(const wchar_t* filename, int &line)
//exit(0);
#endif
SetCursor(oldCur);
- HRSRC hRes = FindResource(hInst, MAKEINTRESOURCE(IDR_SMILES), L"SMILES");
+ HRSRC hRes = FindResource(g_plugin.getInst(), MAKEINTRESOURCE(IDR_SMILES), L"SMILES");
if (!hRes) {
delete mind;
return false;
}
- DWORD size = SizeofResource(hInst, hRes);
+ DWORD size = SizeofResource(g_plugin.getInst(), hRes);
if (!size) {
delete mind;
return false;
}
- HGLOBAL hGlob = LoadResource(hInst, hRes);
+ HGLOBAL hGlob = LoadResource(g_plugin.getInst(), hRes);
if (!hGlob) {
delete mind;
return false;
@@ -223,12 +223,6 @@ static int MessageEventAdded(WPARAM hContact, LPARAM hDbEvent)
return 0;
}
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
void UpdateEverybodyCheckboxes(HWND hwndDlg)
{
bool Enable = BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_EVERYBODY) == BST_CHECKED;
@@ -441,7 +435,7 @@ static int MessageOptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = 910000000;
- odp.hInstance = hInst;
+ odp.hInstance = g_plugin.getInst();
odp.szGroup.a = BOLTUN_GROUP;
odp.szTitle.a = BOLTUN_NAME;
odp.pfnDlgProc = MainDlgProc;
@@ -528,7 +522,7 @@ extern "C" int __declspec(dllexport) Load(void)
{
mir_getLP(&pluginInfo);
- GetModuleFileName(hInst, tszPath, _countof(tszPath));
+ GetModuleFileName(g_plugin.getInst(), tszPath, _countof(tszPath));
*(wcsrchr(tszPath, '\\') + 1) = '\0';
/*initialize miranda hooks and services on options dialog*/
diff --git a/plugins/Boltun/src/stdafx.h b/plugins/Boltun/src/stdafx.h
index 5fb0955d9d..03f9929561 100644
--- a/plugins/Boltun/src/stdafx.h
+++ b/plugins/Boltun/src/stdafx.h
@@ -30,8 +30,6 @@
#include <string>
#include <list>
-#define __NO_CMPLUGIN_NEEDED
-
#include <newpluginapi.h>
#include <m_clist.h>
#include <m_system.h>
@@ -53,6 +51,13 @@
#define BOLTUN_KEY "Boltun"
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(BOLTUN_KEY)
+ {}
+};
+
//Service names
#define SERV_CONTACT_AUTO_CHAT "Boltun/ContactAutoChat"
#define SERV_CONTACT_NOT_TO_CHAT "Boltun/ContactNotToChat"