summaryrefslogtreecommitdiff
path: root/plugins/Db_autobackups/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Db_autobackups/src')
-rw-r--r--plugins/Db_autobackups/src/backup.cpp2
-rw-r--r--plugins/Db_autobackups/src/main.cpp10
-rw-r--r--plugins/Db_autobackups/src/options.cpp6
-rw-r--r--plugins/Db_autobackups/src/stdafx.h10
4 files changed, 13 insertions, 15 deletions
diff --git a/plugins/Db_autobackups/src/backup.cpp b/plugins/Db_autobackups/src/backup.cpp
index cb43a50d68..75e9f26a28 100644
--- a/plugins/Db_autobackups/src/backup.cpp
+++ b/plugins/Db_autobackups/src/backup.cpp
@@ -217,7 +217,7 @@ int Backup(wchar_t *backup_filename)
ShowPopup(dbname, TranslateT("Backup in progress"), nullptr);
if (!options.disable_progress)
- progress_dialog = CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_COPYPROGRESS), nullptr, DlgProcProgress);
+ progress_dialog = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_COPYPROGRESS), nullptr, DlgProcProgress);
SetDlgItemText(progress_dialog, IDC_PROGRESSMESSAGE, TranslateT("Copying database file..."));
diff --git a/plugins/Db_autobackups/src/main.cpp b/plugins/Db_autobackups/src/main.cpp
index 561e31dfeb..ceb612aac9 100644
--- a/plugins/Db_autobackups/src/main.cpp
+++ b/plugins/Db_autobackups/src/main.cpp
@@ -1,7 +1,7 @@
#include "stdafx.h"
+CMPlugin g_plugin;
int hLangpack;
-HINSTANCE g_hInstance;
HANDLE hFolder;
char g_szMirVer[100];
@@ -18,12 +18,6 @@ PLUGININFOEX pluginInfo = {
{ 0x81c220a6, 0x226, 0x4ad6, { 0xbf, 0xca, 0x21, 0x7b, 0x17, 0xa1, 0x60, 0x53 } }
};
-BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD, LPVOID)
-{
- g_hInstance = hInstance;
- return TRUE;
-}
-
static INT_PTR ABService(WPARAM, LPARAM)
{
BackupStart(nullptr);
@@ -122,7 +116,7 @@ extern "C" __declspec(dllexport) int Load(void)
HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoad);
- Icon_Register(g_hInstance, LPGEN("Database") "/" LPGEN("Database backups"), iconList, _countof(iconList));
+ Icon_Register(g_plugin.getInst(), LPGEN("Database") "/" LPGEN("Database backups"), iconList, _countof(iconList));
CreateServiceFunction(MS_AB_BACKUP, ABService);
CreateServiceFunction(MS_AB_SAVEAS, DBSaveAs);
diff --git a/plugins/Db_autobackups/src/options.cpp b/plugins/Db_autobackups/src/options.cpp
index 7a7e9d8fd0..1ef4066053 100644
--- a/plugins/Db_autobackups/src/options.cpp
+++ b/plugins/Db_autobackups/src/options.cpp
@@ -17,7 +17,7 @@ Options::Options() :
Options options;
COptionsDlg::COptionsDlg()
- : CPluginDlgBase(g_hInstance, IDD_OPTIONS, MODULE),
+ : CPluginDlgBase(g_plugin.getInst(), IDD_OPTIONS, MODULE),
m_disable(this, IDC_RAD_DISABLED), m_backupOnStart(this, IDC_RAD_START),
m_backupOnExit(this, IDC_RAD_EXIT), m_backupPeriodic(this, IDC_RAD_PERIODIC),
m_backup(this, IDC_BUT_NOW), m_backupProfile(this, IDC_BACKUPPROFILE),
@@ -277,7 +277,7 @@ void COptionsDlg::CreateToolTip(LPTSTR ptszText, LPTSTR ptszTitle)
(WS_POPUP | TTS_NOPREFIX),
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
- hwndFolder, nullptr, g_hInstance, nullptr);
+ hwndFolder, nullptr, g_plugin.getInst(), nullptr);
if (m_hPathTip == nullptr) {
return;
@@ -289,7 +289,7 @@ void COptionsDlg::CreateToolTip(LPTSTR ptszText, LPTSTR ptszTitle)
ti.cbSize = sizeof(TOOLINFO);
ti.uFlags = TTF_SUBCLASS | TTF_CENTERTIP;
ti.hwnd = hwndFolder;
- ti.hinst = g_hInstance;
+ ti.hinst = g_plugin.getInst();
ti.lpszText = ptszText;
GetClientRect(hwndFolder, &ti.rect);
ti.rect.left = -80;
diff --git a/plugins/Db_autobackups/src/stdafx.h b/plugins/Db_autobackups/src/stdafx.h
index 6ad8c6628b..5152963200 100644
--- a/plugins/Db_autobackups/src/stdafx.h
+++ b/plugins/Db_autobackups/src/stdafx.h
@@ -12,8 +12,6 @@
namespace fs = std::experimental::filesystem;
-#define __NO_CMPLUGIN_NEEDED
-
#include <newpluginapi.h>
#include <m_clist.h>
#include <m_database.h>
@@ -29,6 +27,13 @@ namespace fs = std::experimental::filesystem;
#define MODULE "AutoBackups"
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODULE)
+ {}
+};
+
#include "options.h"
#include "resource.h"
#include "version.h"
@@ -52,7 +57,6 @@ struct ZipFile
int CreateZipFile(const char *szDestPath, OBJLIST<ZipFile> &lstFiles, const std::function<bool(size_t)> &fnCallback);
-extern HINSTANCE g_hInstance;
extern char g_szMirVer[];
static IconItem iconList[] = {