summaryrefslogtreecommitdiff
path: root/plugins/Msg_Export
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-05-17 20:50:08 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-05-17 20:50:08 +0300
commit523f3588b6f21adcc4bcf3ec3ffad05e2298863a (patch)
tree428f9611be9bfdba157f5c2056908ee02c9c7ce6 /plugins/Msg_Export
parent11e70d8c4e224d80015fffe0378c53abee5fd824 (diff)
KeyboardNotify, ListeningTo, MessageState, MirandaG15, MirFox, Msg_Export, MsgPopup, mTextControl => CMPlugin
Diffstat (limited to 'plugins/Msg_Export')
-rwxr-xr-xplugins/Msg_Export/src/FileViewer.cpp8
-rwxr-xr-xplugins/Msg_Export/src/main.cpp58
-rwxr-xr-xplugins/Msg_Export/src/options.cpp6
-rwxr-xr-xplugins/Msg_Export/src/stdafx.h9
4 files changed, 22 insertions, 59 deletions
diff --git a/plugins/Msg_Export/src/FileViewer.cpp b/plugins/Msg_Export/src/FileViewer.cpp
index 2933989a93..074a89672c 100755
--- a/plugins/Msg_Export/src/FileViewer.cpp
+++ b/plugins/Msg_Export/src/FileViewer.cpp
@@ -119,7 +119,7 @@ public:
acFindStr[0] = 0;
memset(&fr, 0, sizeof(fr));
fr.lStructSize = sizeof(fr);
- fr.hInstance = hInstance;
+ fr.hInstance = g_plugin.getInst();
fr.Flags = FR_NOUPDOWN | FR_HIDEUPDOWN;//|FR_MATCHCASE|FR_WHOLEWORD;
// FR_DOWN|FR_FINDNEXT|FR_NOMATCHCASE;
fr.lpstrFindWhat = acFindStr;
@@ -765,7 +765,7 @@ LRESULT CALLBACK EditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
switch (msg) {
case WM_CONTEXTMENU:
{
- HMENU nMenu = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_FV_EDIT));
+ HMENU nMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_FV_EDIT));
HMENU nSubMenu = GetSubMenu(nMenu, 0);
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
@@ -943,7 +943,7 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam,
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
pclDlg = (CLHistoryDlg *)lParam;
- SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadIcon(hInstance, MAKEINTRESOURCE(IDI_EXPORT_MESSAGE)));
+ SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_EXPORT_MESSAGE)));
{
HWND hRichEdit = GetDlgItem(hwndDlg, IDC_RICHEDIT);
mir_subclassWindow(hRichEdit, EditSubclassProc);
@@ -1201,7 +1201,7 @@ bool bShowFileViewer(MCONTACT hContact)
}
CLHistoryDlg *pcl = new CLHistoryDlg(hContact);
- pcl->hWnd = CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_FILE_VIEWER), nullptr, DlgProcFileViewer, (LPARAM)pcl);
+ pcl->hWnd = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FILE_VIEWER), nullptr, DlgProcFileViewer, (LPARAM)pcl);
if (pcl->hWnd) {
mir_cslock lck(csHistoryList);
clHistoryDlgList.push_front(pcl);
diff --git a/plugins/Msg_Export/src/main.cpp b/plugins/Msg_Export/src/main.cpp
index 94c7188e9c..69dc23a94d 100755
--- a/plugins/Msg_Export/src/main.cpp
+++ b/plugins/Msg_Export/src/main.cpp
@@ -18,8 +18,8 @@
#include "stdafx.h"
-HINSTANCE hInstance = nullptr;
-int hLangpack = 0;
+int hLangpack;
+CMPlugin g_plugin;
MWindowList hInternalWindowList = nullptr;
@@ -40,6 +40,10 @@ PLUGININFOEX pluginInfo = {
{ 0x46102b07, 0xc215, 0x4162, { 0x9c, 0x83, 0xd3, 0x77, 0x88, 0x1d, 0xa7, 0xcc } }
};
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
+{
+ return &pluginInfo;
+}
/////////////////////////////////////////////////////////////////////
// Member Function : ShowExportHistory
@@ -57,8 +61,7 @@ PLUGININFOEX pluginInfo = {
static INT_PTR ShowExportHistory(WPARAM wParam, LPARAM /*lParam*/)
{
- if (bUseInternalViewer())
- {
+ if (bUseInternalViewer()) {
bShowFileViewer(wParam);
return 0;
}
@@ -109,11 +112,10 @@ int MainInit(WPARAM /*wparam*/, LPARAM /*lparam*/)
HookEvent(ME_DB_CONTACT_DELETED, nContactDeleted);
HookEvent(ME_OPT_INITIALISE, OptionsInitialize);
- if (!bReplaceHistory)
- {
+ if (!bReplaceHistory) {
CMenuItem mi;
SET_UID(mi, 0x701c543, 0xd078, 0x41dd, 0x95, 0xe3, 0x96, 0x49, 0x8a, 0x72, 0xc7, 0x50);
- mi.hIcolibItem = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_EXPORT_MESSAGE));
+ mi.hIcolibItem = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_EXPORT_MESSAGE));
mi.position = 1000090100;
mi.name.a = LPGEN("Open E&xported History");
mi.pszService = MS_SHOW_EXPORT_HISTORY;
@@ -124,48 +126,6 @@ int MainInit(WPARAM /*wparam*/, LPARAM /*lparam*/)
return 0;
}
-
-
-/////////////////////////////////////////////////////////////////////
-// Member Function : DllMain
-// Type : Global
-// Parameters : hinst - ?
-// fdwReason - ?
-// lpvReserved - ?
-// Returns : BOOL WINAPI
-// Description :
-//
-// References : -
-// Remarks : -
-// Created : 020422, 22 April 2002
-// Developer : KN
-/////////////////////////////////////////////////////////////////////
-
-BOOL WINAPI DllMain(HINSTANCE hinst, DWORD /*fdwReason*/, LPVOID /*lpvReserved*/)
-{
- hInstance = hinst;
- return 1;
-}
-
-
-/////////////////////////////////////////////////////////////////////
-// Member Function : MirandaPluginInfo
-// Type : Global
-// Parameters : mirandaVersion - ?
-// Returns :
-// Description :
-//
-// References : -
-// Remarks : -
-// Created : 020422, 22 April 2002
-// Developer : KN
-/////////////////////////////////////////////////////////////////////
-
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
-{
- return &pluginInfo;
-}
-
/////////////////////////////////////////////////////////////////////
// Member Function : Load
// Type : Global
diff --git a/plugins/Msg_Export/src/options.cpp b/plugins/Msg_Export/src/options.cpp
index 88f4f6001f..d593c7f2e9 100755
--- a/plugins/Msg_Export/src/options.cpp
+++ b/plugins/Msg_Export/src/options.cpp
@@ -285,7 +285,7 @@ int nExportCompleatList(HWND hParent, bool bOnlySelected)
}
// Create progress dialog
- HWND hDlg = data->hDialog = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_EXPORT_ALL_DLG), nullptr, DialogProc);
+ HWND hDlg = data->hDialog = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_EXPORT_ALL_DLG), nullptr, DialogProc);
ShowWindow(hDlg, SW_SHOWNORMAL);
// Process the export in other thread
@@ -870,7 +870,7 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar
case WM_CONTEXTMENU:
if (wParam == (WPARAM)GetDlgItem(hwndDlg, IDC_MAP_USER_LIST)) {
- HMENU hMainMenu = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MSG_EXPORT));
+ HMENU hMainMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_MSG_EXPORT));
if (hMainMenu) {
HMENU hMenu = GetSubMenu(hMainMenu, 0);
@@ -1228,7 +1228,7 @@ int OptionsInitialize(WPARAM wParam, LPARAM /*lParam*/)
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = 100000000;
- odp.hInstance = hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSGEXPORT);
odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE;
odp.szTitle.w = LPGENW("Message export");
diff --git a/plugins/Msg_Export/src/stdafx.h b/plugins/Msg_Export/src/stdafx.h
index 6a4de3ead7..29ba199b25 100755
--- a/plugins/Msg_Export/src/stdafx.h
+++ b/plugins/Msg_Export/src/stdafx.h
@@ -28,8 +28,6 @@ using namespace std;
#include <string>
#include <map>
-#define __NO_CMPLUGIN_NEEDED
-
#include <newpluginapi.h>
#include <m_database.h>
#include <m_clist.h>
@@ -56,7 +54,12 @@ using namespace std;
#define szFileViewDB "FileV_"
#define WM_RELOAD_FILE (WM_USER+10)
-extern HINSTANCE hInstance;
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODULE)
+ {}
+};
extern MWindowList hInternalWindowList;