From 9cf1444eb7888f2d942d220f938aa893396a8a1b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 18 Apr 2018 20:51:18 +0300 Subject: g_hInstance incapulated into PLUGIN<>, no need in the separate variable --- protocols/Gadu-Gadu/src/dialogs.cpp | 14 +++++++------- protocols/Gadu-Gadu/src/gg.cpp | 7 ++++--- protocols/Gadu-Gadu/src/gg.h | 1 - protocols/Gadu-Gadu/src/gg_proto.cpp | 2 +- protocols/Gadu-Gadu/src/groupchat.cpp | 2 +- protocols/Gadu-Gadu/src/icolib.cpp | 2 +- protocols/Gadu-Gadu/src/image.cpp | 8 ++++---- protocols/Gadu-Gadu/src/links.cpp | 2 +- protocols/Gadu-Gadu/src/services.cpp | 2 +- protocols/Gadu-Gadu/src/sessions.cpp | 4 ++-- protocols/Gadu-Gadu/src/token.cpp | 2 +- 11 files changed, 23 insertions(+), 23 deletions(-) (limited to 'protocols/Gadu-Gadu') diff --git a/protocols/Gadu-Gadu/src/dialogs.cpp b/protocols/Gadu-Gadu/src/dialogs.cpp index 5ebdb40815..bc311e486a 100644 --- a/protocols/Gadu-Gadu/src/dialogs.cpp +++ b/protocols/Gadu-Gadu/src/dialogs.cpp @@ -357,19 +357,19 @@ static INT_PTR CALLBACK gg_genoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, dat.gg = gg; if (LOWORD(wParam) == IDC_CREATEACCOUNT) { dat.mode = GG_USERUTIL_CREATE; - ret = DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_CREATEACCOUNT), hwndDlg, gg_userutildlgproc, (LPARAM)&dat); + ret = DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CREATEACCOUNT), hwndDlg, gg_userutildlgproc, (LPARAM)&dat); } else if (LOWORD(wParam) == IDC_CHPASS) { dat.mode = GG_USERUTIL_PASS; - ret = DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_CHPASS), hwndDlg, gg_userutildlgproc, (LPARAM)&dat); + ret = DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CHPASS), hwndDlg, gg_userutildlgproc, (LPARAM)&dat); } else if (LOWORD(wParam) == IDC_CHEMAIL) { dat.mode = GG_USERUTIL_EMAIL; - ret = DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_CHEMAIL), hwndDlg, gg_userutildlgproc, (LPARAM)&dat); + ret = DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CHEMAIL), hwndDlg, gg_userutildlgproc, (LPARAM)&dat); } else { dat.mode = GG_USERUTIL_REMOVE; - ret = DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_REMOVEACCOUNT), hwndDlg, gg_userutildlgproc, (LPARAM)&dat); + ret = DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_REMOVEACCOUNT), hwndDlg, gg_userutildlgproc, (LPARAM)&dat); } if (ret == IDOK) { @@ -759,7 +759,7 @@ int GaduProto::options_init(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE odp = { 0 }; odp.flags = ODPF_UNICODE; odp.position = 1003000; - odp.hInstance = g_hInstance; + odp.hInstance = g_plugin.getInst(); odp.szGroup.w = LPGENW("Network"); odp.szTitle.w = m_tszUserName; odp.dwInitParam = (LPARAM)this; @@ -809,7 +809,7 @@ int GaduProto::details_init(WPARAM wParam, LPARAM lParam) OPTIONSDIALOGPAGE odp = { 0 }; odp.flags = ODPF_DONTTRANSLATE | ODPF_UNICODE; - odp.hInstance = g_hInstance; + odp.hInstance = g_plugin.getInst(); odp.pfnDlgProc = gg_detailsdlgproc; odp.position = -1900000000; odp.pszTemplate = pszTemplate; @@ -867,7 +867,7 @@ INT_PTR CALLBACK gg_acc_mgr_guidlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP dat.email = email; dat.gg = gg; dat.mode = GG_USERUTIL_CREATE; - int ret = DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_CREATEACCOUNT), hwndDlg, gg_userutildlgproc, (LPARAM)&dat); + int ret = DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CREATEACCOUNT), hwndDlg, gg_userutildlgproc, (LPARAM)&dat); if (ret == IDOK) { DBVARIANT dbv; diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp index bec809277c..8bd715294d 100644 --- a/protocols/Gadu-Gadu/src/gg.cpp +++ b/protocols/Gadu-Gadu/src/gg.cpp @@ -38,15 +38,16 @@ PLUGININFOEX pluginInfo = { }; // Other variables -CMPlugin g_plugin; -HINSTANCE g_hInstance; - SSL_API sslApi; CLIST_INTERFACE *pcli; int hLangpack; static unsigned long crc_table[256]; +////////////////////////////////////////////////////////// + +CMPlugin g_plugin; + extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain; ////////////////////////////////////////////////////////// diff --git a/protocols/Gadu-Gadu/src/gg.h b/protocols/Gadu-Gadu/src/gg.h index f96f613fdd..f02dc0be26 100644 --- a/protocols/Gadu-Gadu/src/gg.h +++ b/protocols/Gadu-Gadu/src/gg.h @@ -258,7 +258,6 @@ struct GGGETAVATARDATA struct GaduProto; -extern HINSTANCE g_hInstance; extern CLIST_INTERFACE *pcli; extern PLUGININFOEX pluginInfo; extern IconItem iconList[]; diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index 2b2c9eefc5..7e086f9060 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -507,7 +507,7 @@ static INT_PTR CALLBACK gg_advancedsearchdlgproc(HWND hwndDlg, UINT message, WPA HWND GaduProto::CreateExtendedSearchUI(HWND owner) { - return CreateDialogParam(g_hInstance, + return CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_GGADVANCEDSEARCH), owner, gg_advancedsearchdlgproc, (LPARAM)this); } diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp index 1ea195a83b..d46c8584df 100644 --- a/protocols/Gadu-Gadu/src/groupchat.cpp +++ b/protocols/Gadu-Gadu/src/groupchat.cpp @@ -600,7 +600,7 @@ INT_PTR GaduProto::gc_openconf(WPARAM, LPARAM) return 0; } - CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_CONFERENCE), nullptr, gg_gc_openconfdlg, (LPARAM)this); + CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CONFERENCE), nullptr, gg_gc_openconfdlg, (LPARAM)this); return 1; } diff --git a/protocols/Gadu-Gadu/src/icolib.cpp b/protocols/Gadu-Gadu/src/icolib.cpp index 7ee2a5e5fd..93cd157edc 100644 --- a/protocols/Gadu-Gadu/src/icolib.cpp +++ b/protocols/Gadu-Gadu/src/icolib.cpp @@ -43,7 +43,7 @@ extern IconItem iconList[] = void gg_icolib_init() { - Icon_Register(g_hInstance, "Protocols/" GGDEF_PROTO, iconList, _countof(iconList), GGDEF_PROTO); + Icon_Register(g_plugin.getInst(), "Protocols/" GGDEF_PROTO, iconList, _countof(iconList), GGDEF_PROTO); } HICON LoadIconEx(const char* name, bool big) diff --git a/protocols/Gadu-Gadu/src/image.cpp b/protocols/Gadu-Gadu/src/image.cpp index 909ee5c078..2dc6c14b41 100644 --- a/protocols/Gadu-Gadu/src/image.cpp +++ b/protocols/Gadu-Gadu/src/image.cpp @@ -256,7 +256,7 @@ int gg_img_saveimage(HWND hwnd, GGIMAGEENTRY *dat) OPENFILENAME ofn = { 0 }; ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; ofn.hwndOwner = hwnd; - ofn.hInstance = g_hInstance; + ofn.hInstance = g_plugin.getInst(); ofn.lpstrFile = szFileName; ofn.lpstrFilter = szFilter; ofn.nMaxFile = MAX_PATH; @@ -439,7 +439,7 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP return TRUE; case WM_SIZE: - Utils_ResizeDialog(hwndDlg, g_hInstance, dat->bReceiving ? MAKEINTRESOURCEA(IDD_IMAGE_RECV) : MAKEINTRESOURCEA(IDD_IMAGE_SEND), sttImageDlgResizer); + Utils_ResizeDialog(hwndDlg, g_plugin.getInst(), dat->bReceiving ? MAKEINTRESOURCEA(IDD_IMAGE_RECV) : MAKEINTRESOURCEA(IDD_IMAGE_SEND), sttImageDlgResizer); if (wParam == SIZE_RESTORED || wParam == SIZE_MAXIMIZED) InvalidateRect(hwndDlg, nullptr, FALSE); return 0; @@ -669,7 +669,7 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP *szFileName = 0; ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; ofn.hwndOwner = hwndDlg; - ofn.hInstance = g_hInstance; + ofn.hInstance = g_plugin.getInst(); ofn.lpstrFilter = szFilter; ofn.lpstrFile = szFileName; ofn.nMaxFile = MAX_PATH; @@ -708,7 +708,7 @@ void __cdecl GaduProto::img_dlgcallthread(void *param) HWND hMIWnd = nullptr; GGIMAGEDLGDATA *dat = (GGIMAGEDLGDATA *)param; - DialogBoxParam(g_hInstance, dat->bReceiving ? MAKEINTRESOURCE(IDD_IMAGE_RECV) : MAKEINTRESOURCE(IDD_IMAGE_SEND), + DialogBoxParam(g_plugin.getInst(), dat->bReceiving ? MAKEINTRESOURCE(IDD_IMAGE_RECV) : MAKEINTRESOURCE(IDD_IMAGE_SEND), hMIWnd, gg_img_dlgproc, (LPARAM)dat); #ifdef DEBUGMODE diff --git a/protocols/Gadu-Gadu/src/links.cpp b/protocols/Gadu-Gadu/src/links.cpp index 7ef2ec6cf6..c1f56f702c 100644 --- a/protocols/Gadu-Gadu/src/links.cpp +++ b/protocols/Gadu-Gadu/src/links.cpp @@ -108,7 +108,7 @@ void gg_links_init() { if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE)) { CreateServiceFunction(GGS_PARSELINK, gg_parselink); - AssocMgr_AddNewUrlTypeW("gg:", TranslateT("Gadu-Gadu Link Protocol"), g_hInstance, IDI_GG, GGS_PARSELINK, 0); + AssocMgr_AddNewUrlTypeW("gg:", TranslateT("Gadu-Gadu Link Protocol"), g_plugin.getInst(), IDI_GG, GGS_PARSELINK, 0); } } diff --git a/protocols/Gadu-Gadu/src/services.cpp b/protocols/Gadu-Gadu/src/services.cpp index 425eb044a2..f58bcc2e50 100644 --- a/protocols/Gadu-Gadu/src/services.cpp +++ b/protocols/Gadu-Gadu/src/services.cpp @@ -379,7 +379,7 @@ extern INT_PTR CALLBACK gg_acc_mgr_guidlgproc(HWND hwnd, UINT msg, WPARAM wParam // INT_PTR GaduProto::get_acc_mgr_gui(WPARAM, LPARAM lParam) { - return (INT_PTR)CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_ACCMGRUI), (HWND)lParam, gg_acc_mgr_guidlgproc, (LPARAM)this); + return (INT_PTR)CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ACCMGRUI), (HWND)lParam, gg_acc_mgr_guidlgproc, (LPARAM)this); } ////////////////////////////////////////////////////////// diff --git a/protocols/Gadu-Gadu/src/sessions.cpp b/protocols/Gadu-Gadu/src/sessions.cpp index 63ba37d099..10b4dc5c42 100644 --- a/protocols/Gadu-Gadu/src/sessions.cpp +++ b/protocols/Gadu-Gadu/src/sessions.cpp @@ -360,7 +360,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w return 0; case WM_SIZE: - Utils_ResizeDialog(hwndDlg, g_hInstance, MAKEINTRESOURCEA(IDD_SESSIONS), sttSessionsDlgResizer); + Utils_ResizeDialog(hwndDlg, g_plugin.getInst(), MAKEINTRESOURCEA(IDD_SESSIONS), sttSessionsDlgResizer); return 0; case WM_SETCURSOR: @@ -397,7 +397,7 @@ INT_PTR GaduProto::sessions_view(WPARAM, LPARAM) SetFocus(hwndSessionsDlg); } else - CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_SESSIONS), nullptr, gg_sessions_viewdlg, (LPARAM)this); + CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SESSIONS), nullptr, gg_sessions_viewdlg, (LPARAM)this); return 0; } diff --git a/protocols/Gadu-Gadu/src/token.cpp b/protocols/Gadu-Gadu/src/token.cpp index 9f7f80b87c..322021b80b 100644 --- a/protocols/Gadu-Gadu/src/token.cpp +++ b/protocols/Gadu-Gadu/src/token.cpp @@ -145,7 +145,7 @@ int GaduProto::gettoken(GGTOKEN *token) } // Load token dialog - if (DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_TOKEN), nullptr, gg_tokendlgproc, (LPARAM)&dat) == IDCANCEL) + if (DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_TOKEN), nullptr, gg_tokendlgproc, (LPARAM)&dat) == IDCANCEL) return FALSE; // Fillup patterns -- cgit v1.2.3