diff options
author | George Hazan <ghazan@miranda.im> | 2018-04-18 20:51:18 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-04-18 20:51:18 +0300 |
commit | 9cf1444eb7888f2d942d220f938aa893396a8a1b (patch) | |
tree | ea87e4cb78e9c26a651af00b2d423324ce4a85a6 /protocols/IcqOscarJ | |
parent | 3936ebbc665c9653d9f62527c1e136944d52e2ca (diff) |
g_hInstance incapulated into PLUGIN<>, no need in the separate variable
Diffstat (limited to 'protocols/IcqOscarJ')
-rw-r--r-- | protocols/IcqOscarJ/src/dlgproc.cpp | 2 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/editlist.cpp | 2 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/editstring.cpp | 8 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_firstrun.cpp | 2 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_opts.cpp | 2 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_proto.cpp | 4 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_uploadui.cpp | 2 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_xstatus.cpp | 4 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/init.cpp | 10 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/loginpassword.cpp | 2 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/userinfotab.cpp | 2 |
11 files changed, 22 insertions, 18 deletions
diff --git a/protocols/IcqOscarJ/src/dlgproc.cpp b/protocols/IcqOscarJ/src/dlgproc.cpp index d7c91e5e8c..8a83351565 100644 --- a/protocols/IcqOscarJ/src/dlgproc.cpp +++ b/protocols/IcqOscarJ/src/dlgproc.cpp @@ -440,7 +440,7 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (IsIconic(hwndDlg))
break;
- Utils_ResizeDialog(hwndDlg, g_hInstance, MAKEINTRESOURCEA(IDD_INFO_CHANGEINFO), ChangeInfoDlg_Resize);
+ Utils_ResizeDialog(hwndDlg, g_plugin.getInst(), MAKEINTRESOURCEA(IDD_INFO_CHANGEINFO), ChangeInfoDlg_Resize);
{
RECT rc; // update listview column widths
GetClientRect(dat->hwndList, &rc);
diff --git a/protocols/IcqOscarJ/src/editlist.cpp b/protocols/IcqOscarJ/src/editlist.cpp index f0d88461dd..8f919b577f 100644 --- a/protocols/IcqOscarJ/src/editlist.cpp +++ b/protocols/IcqOscarJ/src/editlist.cpp @@ -80,7 +80,7 @@ void ChangeInfoData::BeginListEdit(int iItem, RECT *rc, int iSetting, WORD wVKey dataListEdit = this;
hwndListEdit = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, L"LISTBOX", L"", WS_POPUP | WS_BORDER | WS_VSCROLL,
- rc->left, rc->bottom, rc->right - rc->left, 150, nullptr, nullptr, g_hInstance, nullptr);
+ rc->left, rc->bottom, rc->right - rc->left, 150, nullptr, nullptr, g_plugin.getInst(), nullptr);
SendMessage(hwndListEdit, WM_SETFONT, (WPARAM)hListFont, 0);
int itemHeight = SendMessage(hwndListEdit, LB_GETITEMHEIGHT, 0, 0);
diff --git a/protocols/IcqOscarJ/src/editstring.cpp b/protocols/IcqOscarJ/src/editstring.cpp index feb334b34b..010f38e068 100644 --- a/protocols/IcqOscarJ/src/editstring.cpp +++ b/protocols/IcqOscarJ/src/editstring.cpp @@ -188,7 +188,7 @@ static LRESULT CALLBACK ExpandButtonSubclassProc(HWND hwnd, UINT msg, WPARAM wPa SendMessage(hwndEdit, EM_GETSEL, (WPARAM)&selStart, (LPARAM)&selEnd);
DestroyWindow(hwndEdit);
EscapesToMultiline(text, &selStart, &selEnd);
- hwndEdit = CreateWindowExA(WS_EX_TOOLWINDOW, "EDIT", "", WS_POPUP | WS_BORDER | WS_VISIBLE | ES_WANTRETURN | ES_AUTOVSCROLL | WS_VSCROLL | ES_MULTILINE, rcStart.left, rcStart.top, rcStart.right - rcStart.left, rcStart.bottom - rcStart.top, nullptr, nullptr, g_hInstance, nullptr);
+ hwndEdit = CreateWindowExA(WS_EX_TOOLWINDOW, "EDIT", "", WS_POPUP | WS_BORDER | WS_VISIBLE | ES_WANTRETURN | ES_AUTOVSCROLL | WS_VSCROLL | ES_MULTILINE, rcStart.left, rcStart.top, rcStart.right - rcStart.left, rcStart.bottom - rcStart.top, nullptr, nullptr, g_plugin.getInst(), nullptr);
SetWindowTextUcs(hwndEdit, text);
mir_subclassWindow(hwndEdit, StringEditSubclassProc);
SendMessage(hwndEdit, WM_SETFONT, (WPARAM)dataStringEdit->hListFont, 0);
@@ -251,13 +251,13 @@ void ChangeInfoData::BeginStringEdit(int iItem, RECT *rc, int i, WORD wVKey) if ((si.displayType & LIM_TYPE) == LI_LONGSTRING) {
rc->right -= rc->bottom - rc->top;
- hwndExpandButton = CreateWindowA("BUTTON", "", WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON | BS_ICON, rc->right, rc->top, rc->bottom - rc->top, rc->bottom - rc->top, hwndList, nullptr, g_hInstance, nullptr);
+ hwndExpandButton = CreateWindowA("BUTTON", "", WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON | BS_ICON, rc->right, rc->top, rc->bottom - rc->top, rc->bottom - rc->top, hwndList, nullptr, g_plugin.getInst(), nullptr);
SendMessage(hwndExpandButton, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIconByHandle(iconList[0].hIcolib));
mir_subclassWindow(hwndExpandButton, ExpandButtonSubclassProc);
}
dataStringEdit = this;
- hwndEdit = CreateWindow(L"EDIT", L"", WS_VISIBLE | WS_CHILD | ES_AUTOHSCROLL | ((si.displayType&LIM_TYPE) == LI_NUMBER ? ES_NUMBER : 0) | (si.displayType&LIF_PASSWORD ? ES_PASSWORD : 0), rc->left, rc->top, rc->right - rc->left, rc->bottom - rc->top, hwndList, nullptr, g_hInstance, nullptr);
+ hwndEdit = CreateWindow(L"EDIT", L"", WS_VISIBLE | WS_CHILD | ES_AUTOHSCROLL | ((si.displayType&LIM_TYPE) == LI_NUMBER ? ES_NUMBER : 0) | (si.displayType&LIF_PASSWORD ? ES_PASSWORD : 0), rc->left, rc->top, rc->right - rc->left, rc->bottom - rc->top, hwndList, nullptr, g_plugin.getInst(), nullptr);
SetWindowTextUtf(hwndEdit, szValue);
if (alloced) SAFE_FREE(&szValue);
mir_subclassWindow(hwndEdit, StringEditSubclassProc);
@@ -265,7 +265,7 @@ void ChangeInfoData::BeginStringEdit(int iItem, RECT *rc, int i, WORD wVKey) if ((si.displayType & LIM_TYPE) == LI_NUMBER) {
int *range = (int*)si.pList;
RECT rcUpDown;
- hwndUpDown = CreateWindow(UPDOWN_CLASS, L"", WS_VISIBLE | WS_CHILD | UDS_AUTOBUDDY | UDS_ALIGNRIGHT | UDS_HOTTRACK | UDS_NOTHOUSANDS | UDS_SETBUDDYINT, 0, 0, 0, 0, hwndList, nullptr, g_hInstance, nullptr);
+ hwndUpDown = CreateWindow(UPDOWN_CLASS, L"", WS_VISIBLE | WS_CHILD | UDS_AUTOBUDDY | UDS_ALIGNRIGHT | UDS_HOTTRACK | UDS_NOTHOUSANDS | UDS_SETBUDDYINT, 0, 0, 0, 0, hwndList, nullptr, g_plugin.getInst(), nullptr);
SendMessage(hwndUpDown, UDM_SETRANGE32, range[0], range[1]);
SendMessage(hwndUpDown, UDM_SETPOS32, 0, sid.value);
if (!(si.displayType & LIF_ZEROISVALID) && sid.value == 0)
diff --git a/protocols/IcqOscarJ/src/icq_firstrun.cpp b/protocols/IcqOscarJ/src/icq_firstrun.cpp index ea5254cf05..6dc0cb6e8f 100644 --- a/protocols/IcqOscarJ/src/icq_firstrun.cpp +++ b/protocols/IcqOscarJ/src/icq_firstrun.cpp @@ -104,5 +104,5 @@ INT_PTR CALLBACK icq_FirstRunDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR INT_PTR CIcqProto::OnCreateAccMgrUI(WPARAM, LPARAM lParam)
{
- return (INT_PTR)CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_ICQACCOUNT), (HWND)lParam, icq_FirstRunDlgProc, LPARAM(this));
+ return (INT_PTR)CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ICQACCOUNT), (HWND)lParam, icq_FirstRunDlgProc, LPARAM(this));
}
diff --git a/protocols/IcqOscarJ/src/icq_opts.cpp b/protocols/IcqOscarJ/src/icq_opts.cpp index f19dcaef7a..83229a25e2 100644 --- a/protocols/IcqOscarJ/src/icq_opts.cpp +++ b/protocols/IcqOscarJ/src/icq_opts.cpp @@ -506,7 +506,7 @@ int CIcqProto::OnOptionsInit(WPARAM wParam, LPARAM) {
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = -800000000;
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.szGroup.w = LPGENW("Network");
odp.dwInitParam = LPARAM(this);
odp.szTitle.w = m_tszUserName;
diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp index a3ec27ff40..ba2ca46ae5 100644 --- a/protocols/IcqOscarJ/src/icq_proto.cpp +++ b/protocols/IcqOscarJ/src/icq_proto.cpp @@ -808,8 +808,8 @@ HANDLE __cdecl CIcqProto::SearchByName(const wchar_t *nick, const wchar_t *first HWND __cdecl CIcqProto::CreateExtendedSearchUI(HWND parent)
{
- if (parent && g_hInstance)
- return CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_ICQADVANCEDSEARCH), parent, AdvancedSearchDlgProc);
+ if (parent && g_plugin.getInst())
+ return CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ICQADVANCEDSEARCH), parent, AdvancedSearchDlgProc);
return nullptr; // Failure
}
diff --git a/protocols/IcqOscarJ/src/icq_uploadui.cpp b/protocols/IcqOscarJ/src/icq_uploadui.cpp index a7eb3bf6cd..fcf7058703 100644 --- a/protocols/IcqOscarJ/src/icq_uploadui.cpp +++ b/protocols/IcqOscarJ/src/icq_uploadui.cpp @@ -866,7 +866,7 @@ void CIcqProto::ShowUploadContactsDialog(void) {
if (hwndUploadContacts == nullptr) {
hItemAll = nullptr;
- hwndUploadContacts = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_ICQUPLOADLIST), nullptr, DlgProcUploadList, LPARAM(this));
+ hwndUploadContacts = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ICQUPLOADLIST), nullptr, DlgProcUploadList, LPARAM(this));
}
SetForegroundWindow(hwndUploadContacts);
diff --git a/protocols/IcqOscarJ/src/icq_xstatus.cpp b/protocols/IcqOscarJ/src/icq_xstatus.cpp index 0505ca7d43..2e0dba715b 100644 --- a/protocols/IcqOscarJ/src/icq_xstatus.cpp +++ b/protocols/IcqOscarJ/src/icq_xstatus.cpp @@ -807,7 +807,7 @@ void CIcqProto::setXStatusEx(BYTE bXStatus, BYTE bQuiet) init.bXStatus = bXStatus;
init.szXStatusName = szName;
init.szXStatusMsg = szMsg;
- CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_SETXSTATUS), nullptr, SetXStatusDlgProc, (LPARAM)&init);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SETXSTATUS), nullptr, SetXStatusDlgProc, (LPARAM)&init);
}
else {
setByte(DBSETTING_XSTATUS_ID, bXStatus);
@@ -916,7 +916,7 @@ INT_PTR CIcqProto::ShowXStatusDetails(WPARAM hContact, LPARAM) init.ppro = this;
init.bAction = 1; // retrieve
init.hContact = hContact;
- CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_SETXSTATUS), nullptr, SetXStatusDlgProc, (LPARAM)&init);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SETXSTATUS), nullptr, SetXStatusDlgProc, (LPARAM)&init);
return 0;
}
diff --git a/protocols/IcqOscarJ/src/init.cpp b/protocols/IcqOscarJ/src/init.cpp index 55d8c21fe8..8d21b12056 100644 --- a/protocols/IcqOscarJ/src/init.cpp +++ b/protocols/IcqOscarJ/src/init.cpp @@ -28,8 +28,6 @@ #include "m_extraicons.h"
#include "m_icolib.h"
-CMPlugin g_plugin;
-HINSTANCE g_hInstance;
int hLangpack;
bool g_bTerminated;
@@ -54,8 +52,14 @@ extern "C" PLUGININFOEX __declspec(dllexport) *MirandaPluginInfoEx(DWORD) return &pluginInfo;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
+/////////////////////////////////////////////////////////////////////////////////////////
+
+CMPlugin g_plugin;
+
extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
/////////////////////////////////////////////////////////////////////////////////////////
@@ -101,7 +105,7 @@ extern "C" int __declspec(dllexport) Load(void) hExtraXStatus = ExtraIcon_RegisterIcolib("xstatus", LPGEN("ICQ xStatus"), "icq_xstatus13");
- Icon_Register(g_hInstance, "ICQ", iconList, _countof(iconList));
+ Icon_Register(g_plugin.getInst(), "ICQ", iconList, _countof(iconList));
g_MenuInit();
return 0;
diff --git a/protocols/IcqOscarJ/src/loginpassword.cpp b/protocols/IcqOscarJ/src/loginpassword.cpp index 1a6d8c1e51..9cff0ea568 100644 --- a/protocols/IcqOscarJ/src/loginpassword.cpp +++ b/protocols/IcqOscarJ/src/loginpassword.cpp @@ -84,5 +84,5 @@ INT_PTR CALLBACK LoginPasswdDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA void CIcqProto::RequestPassword()
{
- DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_LOGINPW), nullptr, LoginPasswdDlgProc, LPARAM(this));
+ DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_LOGINPW), nullptr, LoginPasswdDlgProc, LPARAM(this));
}
diff --git a/protocols/IcqOscarJ/src/userinfotab.cpp b/protocols/IcqOscarJ/src/userinfotab.cpp index 8bd0911293..76ec477cca 100644 --- a/protocols/IcqOscarJ/src/userinfotab.cpp +++ b/protocols/IcqOscarJ/src/userinfotab.cpp @@ -270,7 +270,7 @@ int CIcqProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam) OPTIONSDIALOGPAGE odp = { 0 };
odp.flags = ODPF_UNICODE | ODPF_DONTTRANSLATE;
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.dwInitParam = LPARAM(this);
odp.pfnDlgProc = IcqDlgProc;
odp.position = -1900000000;
|