From f8a6d5631667c382ecc9148f07163cb36681ddc4 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Thu, 17 May 2018 09:57:44 +0300 Subject: IEHistory: cmplugin adaptation --- plugins/IEHistory/src/IEHistory.cpp | 12 +----------- plugins/IEHistory/src/dlgHandlers.cpp | 4 ++-- plugins/IEHistory/src/events.cpp | 2 +- plugins/IEHistory/src/services.cpp | 2 +- plugins/IEHistory/src/stdafx.h | 13 +++++++++---- 5 files changed, 14 insertions(+), 19 deletions(-) (limited to 'plugins/IEHistory/src') diff --git a/plugins/IEHistory/src/IEHistory.cpp b/plugins/IEHistory/src/IEHistory.cpp index 06fabc6490..20d4b71a99 100644 --- a/plugins/IEHistory/src/IEHistory.cpp +++ b/plugins/IEHistory/src/IEHistory.cpp @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" #include "services.h" +CMPlugin g_plugin; int hLangpack;//Miranda NG langpack used by translate functions, filled by mir_getLP() -char ModuleName[] = "IEHistory"; HICON hIcon; HINSTANCE hInstance; MWindowList hOpenWindowsList = nullptr; @@ -99,13 +99,3 @@ extern "C" int __declspec(dllexport) Unload() WindowList_Destroy(hOpenWindowsList); return 0; } - -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID) -{ - hInstance = hinstDLL; - if (fdwReason == DLL_PROCESS_ATTACH) { - DisableThreadLibraryCalls(hinstDLL); - LogInit(); - } - return TRUE; -} diff --git a/plugins/IEHistory/src/dlgHandlers.cpp b/plugins/IEHistory/src/dlgHandlers.cpp index dad7eb3932..5a2d643f3c 100644 --- a/plugins/IEHistory/src/dlgHandlers.cpp +++ b/plugins/IEHistory/src/dlgHandlers.cpp @@ -374,7 +374,7 @@ INT_PTR CALLBACK HistoryDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara 0, 0, //width, height hWnd, //parent (HMENU)IDC_STATUSBAR, //menu - hInstance, //instance + g_plugin.getInst(), //instance nullptr); //lpParam int x; int widths[] = { x = 50, x += 50, x += 150, -1 }; @@ -464,7 +464,7 @@ INT_PTR CALLBACK HistoryDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara break; case IDC_SEARCH: - HWND hSearch = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_SEARCH), hWnd, SearchDlgProc); + HWND hSearch = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SEARCH), hWnd, SearchDlgProc); if (hSearch == nullptr) { char buffer[1024]; sprintf(buffer, "Error #%d", GetLastError()); diff --git a/plugins/IEHistory/src/events.cpp b/plugins/IEHistory/src/events.cpp index e7abc9cff8..175bfff144 100644 --- a/plugins/IEHistory/src/events.cpp +++ b/plugins/IEHistory/src/events.cpp @@ -42,7 +42,7 @@ int OnOptionsInitialize(WPARAM wParam, LPARAM) odp.szTitle.w = LPGENW("History"); odp.pfnDlgProc = OptionsDlgProc; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_HISTORY); - odp.hInstance = hInstance; + odp.hInstance = g_plugin.getInst(); odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE; Options_AddPage(wParam, &odp); return 0; diff --git a/plugins/IEHistory/src/services.cpp b/plugins/IEHistory/src/services.cpp index 84ea58ffee..fd24bb9243 100644 --- a/plugins/IEHistory/src/services.cpp +++ b/plugins/IEHistory/src/services.cpp @@ -44,7 +44,7 @@ INT_PTR ShowContactHistoryService(WPARAM wParam, LPARAM) data->index = 0; data->count = 0; data->loadMethod = (loadInBackground) ? LOAD_IN_BACKGROUND : 0; - historyDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_HISTORY), parent, HistoryDlgProc); + historyDlg = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_HISTORY), parent, HistoryDlgProc); SetWindowLongPtr(historyDlg, DWLP_USER, (LONG_PTR)data); WindowList_Add(hOpenWindowsList, historyDlg, (MCONTACT)wParam); diff --git a/plugins/IEHistory/src/stdafx.h b/plugins/IEHistory/src/stdafx.h index 4ef48c89ed..55a4f4aa59 100644 --- a/plugins/IEHistory/src/stdafx.h +++ b/plugins/IEHistory/src/stdafx.h @@ -34,8 +34,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include -#define __NO_CMPLUGIN_NEEDED - #include #include #include @@ -72,10 +70,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # define sntprintf snwprintf #endif +#define ModuleName "IEHistory" + +struct CMPlugin : public PLUGIN +{ + CMPlugin() : + PLUGIN(ModuleName) + {} +}; + extern HICON hIcon; //history icon extern int hLangpack; -extern char ModuleName[]; -extern HINSTANCE hInstance; //dll instance extern MWindowList hOpenWindowsList; extern PLUGININFOEX pluginInfo; -- cgit v1.2.3