diff options
Diffstat (limited to 'plugins/Quotes/src')
-rw-r--r-- | plugins/Quotes/src/CreateFilePath.cpp | 2 | ||||
-rw-r--r-- | plugins/Quotes/src/CurrencyConverter.cpp | 2 | ||||
-rw-r--r-- | plugins/Quotes/src/Forex.cpp | 61 | ||||
-rw-r--r-- | plugins/Quotes/src/IconLib.cpp | 2 | ||||
-rw-r--r-- | plugins/Quotes/src/QuoteInfoDlg.cpp | 4 | ||||
-rw-r--r-- | plugins/Quotes/src/SettingsDlg.cpp | 10 | ||||
-rw-r--r-- | plugins/Quotes/src/WinCtrlHelper.cpp | 2 | ||||
-rw-r--r-- | plugins/Quotes/src/stdafx.h | 10 |
8 files changed, 49 insertions, 44 deletions
diff --git a/plugins/Quotes/src/CreateFilePath.cpp b/plugins/Quotes/src/CreateFilePath.cpp index 6c73da75b0..f2a28621fb 100644 --- a/plugins/Quotes/src/CreateFilePath.cpp +++ b/plugins/Quotes/src/CreateFilePath.cpp @@ -19,7 +19,7 @@ void prepare_name(tstring& rsName) tstring CreateFilePath(const tstring& rsName)
{
wchar_t szPath[_MAX_PATH];
- ::GetModuleFileName(g_hInstance, szPath, _MAX_PATH);
+ ::GetModuleFileName(g_plugin.getInst(), szPath, _MAX_PATH);
wchar_t* p = wcsrchr(szPath, '\\');
if (p)
diff --git a/plugins/Quotes/src/CurrencyConverter.cpp b/plugins/Quotes/src/CurrencyConverter.cpp index bf0550e8e5..39de2a3805 100644 --- a/plugins/Quotes/src/CurrencyConverter.cpp +++ b/plugins/Quotes/src/CurrencyConverter.cpp @@ -259,7 +259,7 @@ INT_PTR QuotesMenu_CurrencyConverter(WPARAM, LPARAM) SetForegroundWindow(hWnd);
SetFocus(hWnd);
}
- else CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_CURRENCY_CONVERTER), nullptr, CurrencyConverterDlgProc, 0);
+ else CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CURRENCY_CONVERTER), nullptr, CurrencyConverterDlgProc, 0);
return 0;
}
diff --git a/plugins/Quotes/src/Forex.cpp b/plugins/Quotes/src/Forex.cpp index c1f6625f62..0c26e4f717 100644 --- a/plugins/Quotes/src/Forex.cpp +++ b/plugins/Quotes/src/Forex.cpp @@ -4,7 +4,6 @@ #include "stdafx.h"
int hLangpack;
-HINSTANCE g_hInstance = nullptr;
HANDLE g_hEventWorkThreadStop;
//int g_nStatus = ID_STATUS_OFFLINE;
bool g_bAutoUpdate = true;
@@ -25,20 +24,6 @@ HANDLE g_hTBButton; LPSTR g_pszAutoUpdateCmd = "Quotes/Enable-Disable Auto Update";
LPSTR g_pszCurrencyConverter = "Quotes/CurrencyConverter";
-PLUGININFOEX Global_pluginInfo =
-{
- sizeof(PLUGININFOEX),
- __PLUGIN_NAME,
- PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
- __DESCRIPTION,
- __AUTHOR,
- __COPYRIGHT,
- __AUTHORWEB,
- UNICODE_AWARE,
- // {E882056D-0D1D-4131-9A98-404CBAEA6A9C}
- { 0xe882056d, 0xd1d, 0x4131, { 0x9a, 0x98, 0x40, 0x4c, 0xba, 0xea, 0x6a, 0x9c } }
-};
-
void UpdateMenu(bool bAutoUpdate)
{
if (bAutoUpdate) // to enable auto-update
@@ -276,7 +261,7 @@ int QuotesEventFunc_OptInitialise(WPARAM wp, LPARAM/* lp*/) OPTIONSDIALOGPAGE odp = { 0 };
odp.position = 910000000;
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.szTitle.w = _T(QUOTES_PROTOCOL_NAME);
odp.szGroup.w = LPGENW("Network");
odp.flags = ODPF_USERINFOTAB | ODPF_UNICODE;
@@ -290,13 +275,39 @@ inline int Quotes_UnhookEvent(HANDLE h) return UnhookEvent(h);
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+CMPlugin g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
EXTERN_C __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
+/////////////////////////////////////////////////////////////////////////////////////////
+
+PLUGININFOEX Global_pluginInfo =
+{
+ sizeof(PLUGININFOEX),
+ __PLUGIN_NAME,
+ PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
+ __DESCRIPTION,
+ __AUTHOR,
+ __COPYRIGHT,
+ __AUTHORWEB,
+ UNICODE_AWARE,
+ // {E882056D-0D1D-4131-9A98-404CBAEA6A9C}
+ { 0xe882056d, 0xd1d, 0x4131, { 0x9a, 0x98, 0x40, 0x4c, 0xba, 0xea, 0x6a, 0x9c } }
+};
+
EXTERN_C __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &Global_pluginInfo;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
EXTERN_C int __declspec(dllexport) Load(void)
{
mir_getLP(&Global_pluginInfo);
@@ -321,26 +332,12 @@ EXTERN_C int __declspec(dllexport) Load(void) return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
EXTERN_C __declspec(dllexport) int Unload(void)
{
WaitForWorkingThreads();
::CloseHandle(g_hEventWorkThreadStop);
-
return 0;
}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-struct CMPlugin : public PLUGIN<CMPlugin>
-{
- CMPlugin() :
- PLUGIN<CMPlugin>(QUOTES_PROTOCOL_NAME)
- {
- RegisterProtocol(PROTOTYPE_VIRTUAL);
- SetUniqueId(DB_STR_QUOTE_SYMBOL);
- }
-}
- g_plugin;
-
-extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
diff --git a/plugins/Quotes/src/IconLib.cpp b/plugins/Quotes/src/IconLib.cpp index 60a7880328..cd2eac896e 100644 --- a/plugins/Quotes/src/IconLib.cpp +++ b/plugins/Quotes/src/IconLib.cpp @@ -18,7 +18,7 @@ static IconItem iconList[] = void Quotes_IconsInit()
{
- ::Icon_Register(g_hInstance, QUOTES_PROTOCOL_NAME, iconList, _countof(iconList), QUOTES_PROTOCOL_NAME);
+ ::Icon_Register(g_plugin.getInst(), QUOTES_PROTOCOL_NAME, iconList, _countof(iconList), QUOTES_PROTOCOL_NAME);
}
HICON Quotes_LoadIconEx(int iconId, bool bBig /*= false*/)
diff --git a/plugins/Quotes/src/QuoteInfoDlg.cpp b/plugins/Quotes/src/QuoteInfoDlg.cpp index 4a9922e76b..482597d12a 100644 --- a/plugins/Quotes/src/QuoteInfoDlg.cpp +++ b/plugins/Quotes/src/QuoteInfoDlg.cpp @@ -108,7 +108,7 @@ int QuotesEventFunc_OnUserInfoInit(WPARAM wp, LPARAM lp) g_hContact = hContact;
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.pfnDlgProc = QuoteInfoDlgProc;
odp.position = -2000000000;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_DIALOG_QUOTE_INFO);
@@ -221,7 +221,7 @@ int Quotes_OnContactDoubleClick(WPARAM wp, LPARAM/* lp*/) SetFocus(hWnd);
}
else if (true == IsMyContact(hContact))
- CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_DIALOG_QUOTE_INFO_1), nullptr, QuoteInfoDlgProc1, LPARAM(hContact));
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_DIALOG_QUOTE_INFO_1), nullptr, QuoteInfoDlgProc1, LPARAM(hContact));
return 1;
}
diff --git a/plugins/Quotes/src/SettingsDlg.cpp b/plugins/Quotes/src/SettingsDlg.cpp index e9595d65d6..a3d7fb8aaf 100644 --- a/plugins/Quotes/src/SettingsDlg.cpp +++ b/plugins/Quotes/src/SettingsDlg.cpp @@ -110,7 +110,7 @@ void select_log_file(HWND hDlg) ofn.nMaxFile = (DWORD)aFileBuffer.size();
ofn.lpstrFilter = pszFilter;
ofn.nFilterIndex = 1;
- ofn.hInstance = g_hInstance;
+ ofn.hInstance = g_plugin.getInst();
ofn.lpstrDefExt = L"log";
ofn.Flags = OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_EXPLORER;
@@ -351,7 +351,7 @@ INT_PTR CALLBACK EditSettingsPerContactDlgProc(HWND hWnd, UINT msg, WPARAM wp, L pParam->m_pPopupSettings->InitForContact(pParam->m_hContact);
}
- DialogBoxParam(g_hInstance,
+ DialogBoxParam(g_plugin.getInst(),
MAKEINTRESOURCE(IDD_DIALOG_POPUP),
hWnd,
EditPopupSettingsDlgProc, reinterpret_cast<LPARAM>(pParam->m_pPopupSettings));
@@ -470,7 +470,7 @@ void ShowSettingsDlg(MCONTACT hContact) SetForegroundWindow(hWnd);
SetFocus(hWnd);
}
- else CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_CONTACT_SETTINGS), nullptr, EditSettingsPerContactDlgProc, LPARAM(hContact));
+ else CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CONTACT_SETTINGS), nullptr, EditSettingsPerContactDlgProc, LPARAM(hContact));
}
//////////////////////////////////////////////////////////////////////////
@@ -623,7 +623,7 @@ INT_PTR CALLBACK EditSettingsPerProviderDlgProc(HWND hWnd, UINT msg, WPARAM wp, case IDC_BUTTON_POPUP_SETTINGS:
const CAdvProviderSettings* pAdvSettings = reinterpret_cast<CAdvProviderSettings*>(GetWindowLongPtr(hWnd, GWLP_USERDATA));
- DialogBoxParam(g_hInstance,
+ DialogBoxParam(g_plugin.getInst(),
MAKEINTRESOURCE(IDD_DIALOG_POPUP),
hWnd,
EditPopupSettingsDlgProc, reinterpret_cast<LPARAM>(pAdvSettings->GetPopupSettingsPtr()));
@@ -948,7 +948,7 @@ bool ShowSettingsDlg(HWND hWndParent, CAdvProviderSettings* pAdvSettings) {
assert(pAdvSettings);
- return (IDOK == DialogBoxParam(g_hInstance,
+ return (IDOK == DialogBoxParam(g_plugin.getInst(),
MAKEINTRESOURCE(IDD_PROVIDER_ADV_SETTINGS),
hWndParent,
EditSettingsPerProviderDlgProc,
diff --git a/plugins/Quotes/src/WinCtrlHelper.cpp b/plugins/Quotes/src/WinCtrlHelper.cpp index 78be2d2ced..300612dcf1 100644 --- a/plugins/Quotes/src/WinCtrlHelper.cpp +++ b/plugins/Quotes/src/WinCtrlHelper.cpp @@ -32,7 +32,7 @@ static INT_PTR CALLBACK VariableListDlgProc(HWND hWnd, UINT msg, WPARAM wp, LPAR void show_variable_list(HWND hwndParent, const IQuotesProvider* pProvider)
{
- ::DialogBoxParam(g_hInstance,
+ ::DialogBoxParam(g_plugin.getInst(),
MAKEINTRESOURCE(IDD_DIALOG_VARIABLE_LIST),
hwndParent,
VariableListDlgProc,
diff --git a/plugins/Quotes/src/stdafx.h b/plugins/Quotes/src/stdafx.h index abdfcb6ea4..5f9f29486d 100644 --- a/plugins/Quotes/src/stdafx.h +++ b/plugins/Quotes/src/stdafx.h @@ -117,4 +117,12 @@ inline tstring quotes_a2t(const char* s) #include "IXMLEngine.h"
#include "XMLEngineMI.h"
-extern HINSTANCE g_hInstance;
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(QUOTES_PROTOCOL_NAME)
+ {
+ RegisterProtocol(PROTOTYPE_VIRTUAL);
+ SetUniqueId(DB_STR_QUOTE_SYMBOL);
+ }
+};
|