From 3c4beeb99d4324fb453e928421c9b13d70ab4923 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 16 May 2018 18:39:07 +0300 Subject: tabSRMM -> CMPlugin --- plugins/TabSRMM/src/chat_options.cpp | 4 +- plugins/TabSRMM/src/chat_window.cpp | 6 +-- plugins/TabSRMM/src/container.cpp | 12 ++--- plugins/TabSRMM/src/controls.cpp | 6 +-- plugins/TabSRMM/src/eventpopups.cpp | 2 +- plugins/TabSRMM/src/generic_msghandlers.cpp | 8 +-- plugins/TabSRMM/src/globals.cpp | 18 +++---- plugins/TabSRMM/src/infopanel.cpp | 6 +-- plugins/TabSRMM/src/msgdialog.cpp | 4 +- plugins/TabSRMM/src/msgdlgutils.cpp | 4 +- plugins/TabSRMM/src/msgoptions.cpp | 18 +++---- plugins/TabSRMM/src/msgs.cpp | 6 +-- plugins/TabSRMM/src/msgs.h | 7 +++ plugins/TabSRMM/src/sendlater.cpp | 4 +- plugins/TabSRMM/src/sidebar.cpp | 4 +- plugins/TabSRMM/src/srmm.cpp | 77 ++++------------------------- plugins/TabSRMM/src/stdafx.h | 10 ---- plugins/TabSRMM/src/tabctrl.cpp | 2 +- plugins/TabSRMM/src/taskbar.cpp | 2 +- plugins/TabSRMM/src/taskbar.h | 5 +- plugins/TabSRMM/src/themes.cpp | 2 +- plugins/TabSRMM/src/typingnotify.cpp | 2 +- plugins/TabSRMM/src/userprefs.cpp | 4 +- plugins/TabSRMM/src/utils.cpp | 67 +++++++++++++++++++++++-- 24 files changed, 139 insertions(+), 141 deletions(-) (limited to 'plugins/TabSRMM/src') diff --git a/plugins/TabSRMM/src/chat_options.cpp b/plugins/TabSRMM/src/chat_options.cpp index 613588c0e7..e2524a73d0 100644 --- a/plugins/TabSRMM/src/chat_options.cpp +++ b/plugins/TabSRMM/src/chat_options.cpp @@ -374,7 +374,7 @@ HWND CreateToolTip(HWND hwndParent, LPTSTR ptszText, LPTSTR ptszTitle) WS_POPUP | TTS_NOPREFIX, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - hwndParent, nullptr, g_hInst, nullptr); + hwndParent, nullptr, g_plugin.getInst(), nullptr); SetWindowPos(hwndTT, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); @@ -383,7 +383,7 @@ HWND CreateToolTip(HWND hwndParent, LPTSTR ptszText, LPTSTR ptszTitle) ti.cbSize = sizeof(TOOLINFO); ti.uFlags = TTF_SUBCLASS | TTF_CENTERTIP; ti.hwnd = hwndParent; - ti.hinst = g_hInst; + ti.hinst = g_plugin.getInst(); ti.lpszText = ptszText; GetClientRect(hwndParent, &ti.rect); ti.rect.left = -65; diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp index da2636eccf..88f561d7be 100644 --- a/plugins/TabSRMM/src/chat_window.cpp +++ b/plugins/TabSRMM/src/chat_window.cpp @@ -545,7 +545,7 @@ void CChatRoomDlg::OnInitDialog() GetMYUIN(); GetMyNick(); - HWND hwndBtn = CreateWindowEx(0, L"MButtonClass", L"", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, 6, DPISCALEY_S(20), m_hwnd, (HMENU)IDC_TOGGLESIDEBAR, g_hInst, nullptr); + HWND hwndBtn = CreateWindowEx(0, L"MButtonClass", L"", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, 6, DPISCALEY_S(20), m_hwnd, (HMENU)IDC_TOGGLESIDEBAR, g_plugin.getInst(), nullptr); CustomizeButton(hwndBtn); SendMessage(hwndBtn, BUTTONSETASTHEMEDBTN, 1, 0); SendMessage(hwndBtn, BUTTONSETCONTAINER, (LPARAM)m_pContainer, 0); @@ -822,7 +822,7 @@ void CChatRoomDlg::ScrollToBottom() void CChatRoomDlg::ShowFilterMenu() { - m_hwndFilter = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_FILTER), m_pContainer->m_hwnd, FilterWndProc, (LPARAM)this); + m_hwndFilter = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FILTER), m_pContainer->m_hwnd, FilterWndProc, (LPARAM)this); TranslateDialogDefault(m_hwndFilter); RECT rcFilter, rcLog; @@ -1094,7 +1094,7 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) POINT pt; GetCursorPos(&pt); { - HMENU hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT)); + HMENU hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_CONTEXT)); HMENU hSubMenu = GetSubMenu(hMenu, 2); RemoveMenu(hSubMenu, 9, MF_BYPOSITION); RemoveMenu(hSubMenu, 8, MF_BYPOSITION); diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index 48f8eb29e6..c0122e1a2b 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -590,7 +590,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, // tab tooltips... if (!fHaveTipper || M.GetByte("d_tooltips", 0) == 0) { pContainer->m_hwndTip = CreateWindowEx(0, TOOLTIPS_CLASS, nullptr, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, CW_USEDEFAULT, hwndDlg, nullptr, g_hInst, (LPVOID)nullptr); + CW_USEDEFAULT, CW_USEDEFAULT, hwndDlg, nullptr, g_plugin.getInst(), (LPVOID)nullptr); if (pContainer->m_hwndTip) { SetWindowPos(pContainer->m_hwndTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); @@ -894,12 +894,12 @@ panel_found: memset(&tci, 0, sizeof(tci)); tci.mask = TCIF_PARAM; TabCtrl_GetItem(hwndTab, iItem, &tci); - CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_SELECTCONTAINER), hwndDlg, SelectContainerDlgProc, (LPARAM)tci.lParam); + CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SELECTCONTAINER), hwndDlg, SelectContainerDlgProc, (LPARAM)tci.lParam); } break; case ID_TABMENU_CONTAINEROPTIONS: if (pContainer->hWndOptions == nullptr) - CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CONTAINEROPTIONS), hwndDlg, DlgProcContainerOptions, (LPARAM)pContainer); + CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CONTAINEROPTIONS), hwndDlg, DlgProcContainerOptions, (LPARAM)pContainer); break; case ID_TABMENU_CLOSECONTAINER: SendMessage(hwndDlg, WM_CLOSE, 0, 0); @@ -1227,7 +1227,7 @@ panel_found: if (IsIconic(pContainer->m_hwnd)) SendMessage(pContainer->m_hwnd, WM_SYSCOMMAND, SC_RESTORE, 0); if (pContainer->hWndOptions == nullptr) - CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CONTAINEROPTIONS), hwndDlg, DlgProcContainerOptions, (LPARAM)pContainer); + CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CONTAINEROPTIONS), hwndDlg, DlgProcContainerOptions, (LPARAM)pContainer); break; case SC_MAXIMIZE: pContainer->oldSize.cx = pContainer->oldSize.cy = 0; @@ -1574,7 +1574,7 @@ panel_found: } } else if (pContainer->hwndStatus == nullptr) { - pContainer->hwndStatus = CreateWindowEx(0, L"TSStatusBarClass", nullptr, SBT_TOOLTIPS | WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, hwndDlg, nullptr, g_hInst, nullptr); + pContainer->hwndStatus = CreateWindowEx(0, L"TSStatusBarClass", nullptr, SBT_TOOLTIPS | WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, hwndDlg, nullptr, g_plugin.getInst(), nullptr); if (sBarHeight && bSkinned) SendMessage(pContainer->hwndStatus, SB_SETMINHEIGHT, sBarHeight, 0); @@ -1945,7 +1945,7 @@ TContainerData* TSAPI CreateContainer(const wchar_t *name, int iTemp, MCONTACT h pContainer->dwFlags |= CNT_CREATE_CLONED; pContainer->hContactFrom = hContactFrom; } - pContainer->m_hwnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSGCONTAINER), nullptr, DlgProcContainer, (LPARAM)pContainer); + pContainer->m_hwnd = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_MSGCONTAINER), nullptr, DlgProcContainer, (LPARAM)pContainer); return pContainer; } diff --git a/plugins/TabSRMM/src/controls.cpp b/plugins/TabSRMM/src/controls.cpp index 7564db1289..59262277da 100644 --- a/plugins/TabSRMM/src/controls.cpp +++ b/plugins/TabSRMM/src/controls.cpp @@ -41,7 +41,7 @@ static int resetLP(WPARAM, LPARAM, LPARAM obj) { if (PluginConfig.g_hMenuContext) DestroyMenu(PluginConfig.g_hMenuContext); - PluginConfig.g_hMenuContext = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_TABCONTEXT)); + PluginConfig.g_hMenuContext = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_TABCONTEXT)); TranslateMenu(PluginConfig.g_hMenuContext); ((CMenuBar*)obj)->resetLP(); @@ -71,7 +71,7 @@ CMenuBar::CMenuBar(HWND hwndParent, const TContainerData *pContainer) m_MimIconRefCount++; m_hwndToolbar = ::CreateWindowEx(WS_EX_TOOLWINDOW, TOOLBARCLASSNAME, nullptr, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE | TBSTYLE_FLAT | TBSTYLE_TRANSPARENT | TBSTYLE_LIST |/*CCS_NOPARENTALIGN|*/CCS_NODIVIDER | CCS_TOP, - 0, 0, 0, 0, hwndParent, nullptr, g_hInst, nullptr); + 0, 0, 0, 0, hwndParent, nullptr, g_plugin.getInst(), nullptr); ::SendMessage(m_hwndToolbar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0); @@ -672,7 +672,7 @@ LONG_PTR CALLBACK CTabBaseDlg::StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM if (OldStatusBarproc == nullptr) { WNDCLASSEX wc = { 0 }; wc.cbSize = sizeof(wc); - GetClassInfoEx(g_hInst, STATUSCLASSNAME, &wc); + GetClassInfoEx(g_plugin.getInst(), STATUSCLASSNAME, &wc); OldStatusBarproc = wc.lpfnWndProc; } diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp index 89d57735f9..77857705ce 100644 --- a/plugins/TabSRMM/src/eventpopups.cpp +++ b/plugins/TabSRMM/src/eventpopups.cpp @@ -229,7 +229,7 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa break; case IDC_POPUPSTATUSMODES: - hwndNew = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CHOOSESTATUSMODES), hWnd, DlgProcSetupStatusModes, M.GetDword(MODULE, "statusmask", (DWORD)-1)); + hwndNew = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CHOOSESTATUSMODES), hWnd, DlgProcSetupStatusModes, M.GetDword(MODULE, "statusmask", (DWORD)-1)); SendMessage(hwndNew, DM_SETPARENTDIALOG, 0, (LPARAM)hWnd); break; diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 5653d2dd2b..f5b0c07645 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -97,12 +97,12 @@ void CTabBaseDlg::DM_DismissTip(const POINT& pt) void CTabBaseDlg::DM_InitTip() { m_hwndTip = CreateWindowEx(0, TOOLTIPS_CLASS, nullptr, WS_POPUP | TTS_NOPREFIX | TTS_BALLOON, CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, CW_USEDEFAULT, m_hwnd, nullptr, g_hInst, (LPVOID)nullptr); + CW_USEDEFAULT, CW_USEDEFAULT, m_hwnd, nullptr, g_plugin.getInst(), (LPVOID)nullptr); memset(&ti, 0, sizeof(ti)); ti.cbSize = sizeof(ti); ti.lpszText = TranslateT("No status message"); - ti.hinst = g_hInst; + ti.hinst = g_plugin.getInst(); ti.hwnd = m_hwnd; ti.uFlags = TTF_TRACK | TTF_IDISHWND | TTF_TRANSPARENT; ti.uId = (UINT_PTR)m_hwnd; @@ -131,7 +131,7 @@ bool CTabBaseDlg::DM_GenericHotkeysCheck(MSG *message) case TABSRMM_HK_CONTAINEROPTIONS: if (m_pContainer->hWndOptions == nullptr) - CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CONTAINEROPTIONS), m_pContainer->m_hwnd, DlgProcContainerOptions, (LPARAM)m_pContainer); + CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CONTAINEROPTIONS), m_pContainer->m_hwnd, DlgProcContainerOptions, (LPARAM)m_pContainer); return true; case TABSRMM_HK_SEND: @@ -825,7 +825,7 @@ HWND CTabBaseDlg::DM_CreateClist() return nullptr; } - HWND hwndClist = CreateWindowExA(0, "CListControl", "", WS_TABSTOP | WS_VISIBLE | WS_CHILD | 0x248, 184, 0, 30, 30, m_hwnd, (HMENU)IDC_CLIST, g_hInst, nullptr); + HWND hwndClist = CreateWindowExA(0, "CListControl", "", WS_TABSTOP | WS_VISIBLE | WS_CHILD | 0x248, 184, 0, 30, 30, m_hwnd, (HMENU)IDC_CLIST, g_plugin.getInst(), nullptr); SendMessage(hwndClist, WM_TIMER, 14, 0); HANDLE hItem = (HANDLE)SendMessage(hwndClist, CLM_FINDCONTACT, m_hContact, 0); diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index 6ff956a773..1a3f9fe099 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -64,7 +64,7 @@ void CGlobals::reloadSystemStartup() dwThreadID = GetCurrentThreadId(); - PluginConfig.g_hMenuContext = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_TABCONTEXT)); + PluginConfig.g_hMenuContext = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_TABCONTEXT)); TranslateMenu(g_hMenuContext); Skin_AddSound("RecvMsgActive", LPGENW("Instant messages"), LPGENW("Incoming (focused window)")); @@ -172,7 +172,7 @@ void CGlobals::reloadSettings(bool fReloadSkins) m_autoSplit = M.GetByte("autosplit", 0); m_FlashOnMTN = M.GetByte(SRMSGMOD, SRMSGSET_SHOWTYPINGWINFLASH, SRMSGDEFSET_SHOWTYPINGWINFLASH); if (m_MenuBar == nullptr) { - m_MenuBar = ::LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_MENUBAR)); + m_MenuBar = ::LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_MENUBAR)); TranslateMenu(m_MenuBar); } @@ -219,7 +219,7 @@ void CGlobals::reloadAdv() const HMENU CGlobals::getMenuBar() { if (m_MenuBar == nullptr) { - m_MenuBar = ::LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_MENUBAR)); + m_MenuBar = ::LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_MENUBAR)); TranslateMenu(m_MenuBar); } return(m_MenuBar); @@ -290,7 +290,7 @@ int CGlobals::ModulesLoaded(WPARAM, LPARAM) if (M.GetByte("avatarmode", -1) == -1) db_set_b(0, SRMSGMOD_T, "avatarmode", 2); - PluginConfig.g_hwndHotkeyHandler = CreateWindowEx(0, L"TSHK", L"", WS_POPUP, 0, 0, 40, 40, nullptr, nullptr, g_hInst, nullptr); + PluginConfig.g_hwndHotkeyHandler = CreateWindowEx(0, L"TSHK", L"", WS_POPUP, 0, 0, 40, 40, nullptr, nullptr, g_plugin.getInst(), nullptr); ::CreateTrayMenus(TRUE); if (nen_options.bTraySupport) @@ -458,11 +458,11 @@ int CGlobals::PreshutdownSendRecv(WPARAM, LPARAM) ::NEN_WriteOptions(&nen_options); ::DestroyWindow(PluginConfig.g_hwndHotkeyHandler); - ::UnregisterClass(L"TSStatusBarClass", g_hInst); - ::UnregisterClass(L"SideBarClass", g_hInst); - ::UnregisterClass(L"TSTabCtrlClass", g_hInst); - ::UnregisterClass(L"RichEditTipClass", g_hInst); - ::UnregisterClass(L"TSHK", g_hInst); + ::UnregisterClass(L"TSStatusBarClass", g_plugin.getInst()); + ::UnregisterClass(L"SideBarClass", g_plugin.getInst()); + ::UnregisterClass(L"TSTabCtrlClass", g_plugin.getInst()); + ::UnregisterClass(L"RichEditTipClass", g_plugin.getInst()); + ::UnregisterClass(L"TSHK", g_plugin.getInst()); return 0; } diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp index 73de2f3dad..ffd67d6fda 100644 --- a/plugins/TabSRMM/src/infopanel.cpp +++ b/plugins/TabSRMM/src/infopanel.cpp @@ -1253,7 +1253,7 @@ int CInfoPanel::invokeConfigDialog(const POINT &pt) if (m_hwndConfig == nullptr) { m_configDlgBoldFont = m_configDlgFont = nullptr; - m_hwndConfig = ::CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_INFOPANEL), nullptr /*m_dat->m_pContainer->m_hwnd */, + m_hwndConfig = ::CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_INFOPANEL), nullptr /*m_dat->m_pContainer->m_hwnd */, ConfigDlgProcStub, (LPARAM)this); if (m_hwndConfig) { TranslateDialogDefault(m_hwndConfig); @@ -1306,10 +1306,10 @@ void CInfoPanel::dismissConfig(bool fForced) CTip::CTip(const HWND hwndParent, const MCONTACT hContact, const wchar_t *pszText, const CInfoPanel* panel) { m_hwnd = ::CreateWindowEx(WS_EX_TOOLWINDOW, L"RichEditTipClass", L"", (M.isAero() ? WS_THICKFRAME : WS_BORDER) | WS_POPUPWINDOW | WS_TABSTOP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, - 0, 0, 40, 40, nullptr, nullptr, g_hInst, this); + 0, 0, 40, 40, nullptr, nullptr, g_plugin.getInst(), this); m_hRich = ::CreateWindowEx(0, L"RICHEDIT50W", L"", WS_CHILD | ES_MULTILINE | ES_AUTOVSCROLL | ES_NOHIDESEL | ES_READONLY | WS_VSCROLL | WS_TABSTOP, - 0, 0, 40, 40, m_hwnd, reinterpret_cast(1000), g_hInst, nullptr); + 0, 0, 40, 40, m_hwnd, reinterpret_cast(1000), g_plugin.getInst(), nullptr); ::SendMessage(m_hRich, EM_AUTOURLDETECT, TRUE, 0); ::SendMessage(m_hRich, EM_SETEVENTMASK, 0, ENM_LINK); diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index be9485c0e8..58b24b432f 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -75,7 +75,7 @@ void CTabBaseDlg::ShowPopupMenu(const CCtrlBase &pCtrl, POINT pt) { CHARRANGE sel, all = { 0, -1 }; - HMENU hSubMenu, hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT)); + HMENU hSubMenu, hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_CONTEXT)); if (pCtrl.GetCtrlId() == IDC_SRMM_LOG) hSubMenu = GetSubMenu(hMenu, 0); else { @@ -643,7 +643,7 @@ void CSrmmWindow::OnInitDialog() GetClientIcon(); CustomizeButton(CreateWindowEx(0, L"MButtonClass", L"", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, 6, DPISCALEY_S(20), - m_hwnd, (HMENU)IDC_TOGGLESIDEBAR, g_hInst, nullptr)); + m_hwnd, (HMENU)IDC_TOGGLESIDEBAR, g_plugin.getInst(), nullptr)); m_hwndPanelPicParent = CreateWindowEx(WS_EX_TOPMOST, L"Static", L"", SS_OWNERDRAW | WS_VISIBLE | WS_CHILD, 1, 1, 1, 1, m_hwnd, (HMENU)6000, nullptr, nullptr); mir_subclassWindow(m_hwndPanelPicParent, CInfoPanel::avatarParentSubclass); diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index 4ef01fa859..1019b82a75 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -306,11 +306,11 @@ int CTabBaseDlg::MsgWindowMenuHandler(int selection, int menuId) if (menuId == MENU_PICMENU || menuId == MENU_PANELPICMENU || menuId == MENU_TABCONTEXT) { switch (selection) { case ID_TABMENU_ATTACHTOCONTAINER: - CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_SELECTCONTAINER), m_hwnd, SelectContainerDlgProc, (LPARAM)m_hwnd); + CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SELECTCONTAINER), m_hwnd, SelectContainerDlgProc, (LPARAM)m_hwnd); return 1; case ID_TABMENU_CONTAINEROPTIONS: if (m_pContainer->hWndOptions == nullptr) - CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CONTAINEROPTIONS), m_hwnd, DlgProcContainerOptions, (LPARAM)m_pContainer); + CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CONTAINEROPTIONS), m_hwnd, DlgProcContainerOptions, (LPARAM)m_pContainer); return 1; case ID_TABMENU_CLOSECONTAINER: SendMessage(m_pContainer->m_hwnd, WM_CLOSE, 0, 0); diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index c3e302df02..8a78e85925 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -576,7 +576,7 @@ class COptMainDlg : public CDlgBase public: COptMainDlg() : - CDlgBase(g_hInst, IDD_OPT_MSGDLG), + CDlgBase(g_plugin.getInst(), IDD_OPT_MSGDLG), urlHelp(this, IDC_HELP_GENERAL, "https://wiki.miranda-ng.org/index.php?title=Plugin:TabSRMM/en/General_settings"), btnReset(this, IDC_RESETWARNINGS), spnAvaSize(this, IDC_AVATARSPIN), @@ -656,7 +656,7 @@ class COptLogDlg : public CDlgBase public: COptLogDlg() - : CDlgBase(g_hInst, IDD_OPT_MSGLOG), + : CDlgBase(g_plugin.getInst(), IDD_OPT_MSGLOG), btnModify(this, IDC_MODIFY), btnRtlModify(this, IDC_RTLMODIFY), spnTrim(this, IDC_TRIMSPIN), @@ -895,7 +895,7 @@ class COptTypingDlg : public CDlgBase public: COptTypingDlg() - : CDlgBase(g_hInst, IDD_OPT_MSGTYPE), + : CDlgBase(g_plugin.getInst(), IDD_OPT_MSGTYPE), urlHelp(this, IDC_MTN_HELP, "https://wiki.miranda-ng.org/index.php?title=Plugin:TabSRMM/en/Advanced_tweaks"), chkWin(this, IDC_TYPEWIN), chkNoWin(this, IDC_TYPENOWIN), @@ -1023,7 +1023,7 @@ class COptTabbedDlg : public CDlgBase public: COptTabbedDlg() : - CDlgBase(g_hInst, IDD_OPT_TABBEDMSG), + CDlgBase(g_plugin.getInst(), IDD_OPT_TABBEDMSG), chkLimit(this, IDC_CUT_TABTITLE), edtLimit(this, IDC_CUT_TITLEMAX), spnLimit(this, IDC_CUT_TITLEMAXSPIN), @@ -1069,7 +1069,7 @@ public: void onClick_Setup(CCtrlButton*) { - HWND hwndNew = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CHOOSESTATUSMODES), m_hwnd, DlgProcSetupStatusModes, M.GetDword("autopopupmask", -1)); + HWND hwndNew = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CHOOSESTATUSMODES), m_hwnd, DlgProcSetupStatusModes, M.GetDword("autopopupmask", -1)); SendMessage(hwndNew, DM_SETPARENTDIALOG, 0, (LPARAM)m_hwnd); } @@ -1114,7 +1114,7 @@ class COptContainersDlg : public CDlgBase public: COptContainersDlg() - : CDlgBase(g_hInst, IDD_OPT_CONTAINERS), + : CDlgBase(g_plugin.getInst(), IDD_OPT_CONTAINERS), urlHelp(this, IDC_HELP_CONTAINERS, "https://wiki.miranda-ng.org/index.php?title=Plugin:TabSRMM/en/Containers"), spnNumFlash(this, IDC_NRFLASHSPIN), spnTabLimit(this, IDC_TABLIMITSPIN), @@ -1196,7 +1196,7 @@ class COptAdvancedDlg : public CDlgBase public: COptAdvancedDlg() : - CDlgBase(g_hInst, IDD_OPTIONS_PLUS), + CDlgBase(g_plugin.getInst(), IDD_OPTIONS_PLUS), urlHelp(this, IDC_PLUS_HELP, "https://wiki.miranda-ng.org/index.php?title=Plugin:TabSRMM/en/Typing_notifications"), btnRevert(this, IDC_PLUS_REVERT), spnTimeout(this, IDC_TIMEOUTSPIN), @@ -1288,7 +1288,7 @@ static int OptInitialise(WPARAM wParam, LPARAM lParam) OPTIONSDIALOGPAGE odpnew = {}; odpnew.position = 910000000; - odpnew.hInstance = g_hInst; + odpnew.hInstance = g_plugin.getInst(); odpnew.flags = ODPF_BOLDGROUPS; odpnew.szTitle.a = LPGEN("Message sessions"); @@ -1318,7 +1318,7 @@ static int OptInitialise(WPARAM wParam, LPARAM lParam) Options_AddPage(wParam, &odpnew); OPTIONSDIALOGPAGE odp = {}; - odp.hInstance = g_hInst; + odp.hInstance = g_plugin.getInst(); odp.flags = ODPF_BOLDGROUPS; odp.position = 910000000; diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index 3d3c676de8..6ceaa99cf9 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -62,7 +62,7 @@ int SmileyAddOptionsChanged(WPARAM, LPARAM) // basic window class CTabBaseDlg::CTabBaseDlg(int iResource, SESSION_INFO *si) - : CSrmmBaseDialog(g_hInst, iResource, si), + : CSrmmBaseDialog(g_plugin.getInst(), iResource, si), m_pPanel(this), m_dwFlags(MWF_INITMODE), m_iInputAreaHeight(-1) @@ -308,7 +308,7 @@ static INT_PTR SetUserPrefs(WPARAM wParam, LPARAM) SetForegroundWindow(hWnd); // already open, bring it to front return 0; } - CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_USERPREFS_FRAME), nullptr, DlgProcUserPrefsFrame, (LPARAM)wParam); + CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_USERPREFS_FRAME), nullptr, DlgProcUserPrefsFrame, (LPARAM)wParam); return 0; } @@ -748,7 +748,7 @@ void TSAPI CreateImageList(BOOL bInitial) // an icon on each tab. This is a blank and empty icon if (bInitial) { PluginConfig.g_hImageList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 2, 0); - HICON hIcon = CreateIcon(g_hInst, 16, 16, 1, 4, nullptr, nullptr); + HICON hIcon = CreateIcon(g_plugin.getInst(), 16, 16, 1, 4, nullptr, nullptr); ImageList_AddIcon(PluginConfig.g_hImageList, hIcon); DestroyIcon(hIcon); } diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index 5939a31633..7b1a36f1fb 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -1123,4 +1123,11 @@ struct SKINDESC #define ICON_BUTTON_CANCEL 6 #define ICON_BUTTON_SAVE 7 +struct CMPlugin : public PLUGIN +{ + CMPlugin() : + PLUGIN(SRMSGMOD) + {} +}; + #endif /* _MSGS_H */ diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp index be918c6e92..e35033e2aa 100644 --- a/plugins/TabSRMM/src/sendlater.cpp +++ b/plugins/TabSRMM/src/sendlater.cpp @@ -693,7 +693,7 @@ INT_PTR CALLBACK CSendLater::DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if (((LPNMHDR)lParam)->hwndFrom == m_hwndList) { switch (((LPNMHDR)lParam)->code) { case NM_RCLICK: - HMENU hMenu = ::LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_TABCONTEXT)); + HMENU hMenu = ::LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_TABCONTEXT)); HMENU hSubMenu = ::GetSubMenu(hMenu, 9); ::TranslateMenu(hSubMenu); @@ -829,7 +829,7 @@ INT_PTR CALLBACK CSendLater::DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM void CSendLater::invokeQueueMgrDlg() { if (m_hwndDlg == nullptr) - m_hwndDlg = ::CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_SENDLATER_QMGR), nullptr, CSendLater::DlgProcStub, LPARAM(this)); + m_hwndDlg = ::CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SENDLATER_QMGR), nullptr, CSendLater::DlgProcStub, LPARAM(this)); } // service function to invoke the queue manager diff --git a/plugins/TabSRMM/src/sidebar.cpp b/plugins/TabSRMM/src/sidebar.cpp index 5edaaf8bbd..cf64ff1ad1 100644 --- a/plugins/TabSRMM/src/sidebar.cpp +++ b/plugins/TabSRMM/src/sidebar.cpp @@ -95,7 +95,7 @@ void CSideBarButton::_create() m_sz.cx = m_sz.cy = 0; m_hwnd = ::CreateWindowEx(0, L"MButtonClass", L"", WS_CHILD | WS_TABSTOP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, - 0, 0, 40, 40, m_sideBar->getScrollWnd(), reinterpret_cast(m_id), g_hInst, nullptr); + 0, 0, 40, 40, m_sideBar->getScrollWnd(), reinterpret_cast(m_id), g_plugin.getInst(), nullptr); if (m_hwnd) { CustomizeButton(m_hwnd); ::SendMessage(m_hwnd, BUTTONSETASSIDEBARBUTTON, (WPARAM)this, 0); @@ -392,7 +392,7 @@ void CSideBar::Init() if (m_pContainer->dwFlags & CNT_SIDEBAR) { if (m_hwndScrollWnd == nullptr) m_hwndScrollWnd = ::CreateWindowEx(0, L"TS_SideBarClass", L"", WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE | WS_CHILD, - 0, 0, m_width, 40, m_pContainer->m_hwnd, reinterpret_cast(5000), g_hInst, this); + 0, 0, m_width, 40, m_pContainer->m_hwnd, reinterpret_cast(5000), g_plugin.getInst(), this); m_isActive = true; m_isVisible = m_isActive ? m_isVisible : true; diff --git a/plugins/TabSRMM/src/srmm.cpp b/plugins/TabSRMM/src/srmm.cpp index 432dffe6a2..1b5fcd24f9 100644 --- a/plugins/TabSRMM/src/srmm.cpp +++ b/plugins/TabSRMM/src/srmm.cpp @@ -28,16 +28,18 @@ #include "stdafx.h" -HINSTANCE g_hInst; LOGFONT lfDefault = { 0 }; /* * miranda interfaces */ +CMPlugin g_plugin; int hLangpack; CLIST_INTERFACE *pcli; +///////////////////////////////////////////////////////////////////////////////////////// + PLUGININFOEX pluginInfo = { sizeof(PLUGININFOEX), __PLUGIN_NAME, @@ -51,19 +53,17 @@ PLUGININFOEX pluginInfo = { { 0x6ca5f042, 0x7a7f, 0x47cc, { 0xa7, 0x15, 0xfc, 0x8c, 0x46, 0xfb, 0xf4, 0x34 } } }; -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) -{ - g_hInst = hinstDLL; - return TRUE; -} - extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) { return &pluginInfo; } +///////////////////////////////////////////////////////////////////////////////////////// + extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_SRMM, MIID_LAST }; +///////////////////////////////////////////////////////////////////////////////////////// + extern "C" int __declspec(dllexport) Load(void) { if (WinVerMajor() < 5) { @@ -81,6 +81,8 @@ extern "C" int __declspec(dllexport) Load(void) return LoadSendRecvMessageModule(); } +///////////////////////////////////////////////////////////////////////////////////////// + extern "C" int __declspec(dllexport) Unload(void) { FreeLogFonts(); @@ -94,64 +96,3 @@ extern "C" int __declspec(dllexport) Unload(void) delete sendQueue; return iRet; } - -int _DebugTraceW(const wchar_t *fmt, ...) -{ - wchar_t debug[2048]; - int ibsize = 2047; - SYSTEMTIME st; - va_list va; - char tszTime[50]; - va_start(va, fmt); - - GetLocalTime(&st); - - mir_snprintf(tszTime, "%02d.%02d.%04d - %02d:%02d:%02d.%04d: ", st.wDay, st.wMonth, st.wYear, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds); - - - mir_vsnwprintf(debug, ibsize - 10, fmt, va); - //#ifdef _DEBUG - OutputDebugStringW(debug); - //#else - { - char szLogFileName[MAX_PATH], szDataPath[MAX_PATH]; - FILE *f; - - Profile_GetPathA(MAX_PATH, szDataPath); - mir_snprintf(szLogFileName, "%s\\%s", szDataPath, "tabsrmm_debug.log"); - f = fopen(szLogFileName, "a+"); - if (f) { - fputs(tszTime, f); - fputs(T2Utf(debug), f); - fputs("\n", f); - fclose(f); - } - } - //#endif - return 0; -} - -/* - * output a notification message. - * may accept a hContact to include the contacts nickname in the notification message... - * the actual message is using printf() rules for formatting and passing the arguments... - * - * can display the message either as systray notification (baloon popup) or using the - * popup plugin. - */ -int _DebugPopup(MCONTACT hContact, const wchar_t *fmt, ...) -{ - va_list va; - wchar_t debug[1024]; - int ibsize = 1023; - - va_start(va, fmt); - mir_vsnwprintf(debug, ibsize, fmt, va); - - wchar_t szTitle[128]; - mir_snwprintf(szTitle, TranslateT("TabSRMM message (%s)"), - (hContact != 0) ? Clist_GetContactDisplayName(hContact) : TranslateT("Global")); - - Clist_TrayNotifyW(nullptr, szTitle, debug, NIIF_INFO, 1000 * 4); - return 0; -} diff --git a/plugins/TabSRMM/src/stdafx.h b/plugins/TabSRMM/src/stdafx.h index f0a4e8ae34..46b57635c5 100644 --- a/plugins/TabSRMM/src/stdafx.h +++ b/plugins/TabSRMM/src/stdafx.h @@ -26,9 +26,6 @@ // // global include file, used to build the precompiled header. -#ifndef __stdafx_H -#define __stdafx_H - #include #include #include @@ -135,7 +132,6 @@ typedef struct _DWM_THUMBNAIL_PROPERTIES #include "ImageDataObject.h" #include "muchighlight.h" - /* * text shadow types (DrawThemeTextEx() / Vista+ uxtheme) */ @@ -217,7 +213,6 @@ typedef struct _BP_PAINTPARAMS #endif extern NEN_OPTIONS nen_options; -extern HINSTANCE g_hInst; extern CSkinItem SkinItems[]; extern TContainerData *pFirstContainer, *pLastActiveContainer; extern ButtonSet g_ButtonSet; @@ -245,7 +240,6 @@ void FreeLogFonts(); INT_PTR SendMessageCommand(WPARAM wParam, LPARAM lParam); INT_PTR SendMessageCommand_W(WPARAM wParam, LPARAM lParam); - #define IMG_NOCHECK 0 #define IMG_CHECK 1 #define IMG_GRPOPEN 2 @@ -260,8 +254,6 @@ BOOL TreeViewHandleClick(HWND hwndDlg, HWND hwndTree, WPARAM wParam, LPARAM lPar INT_PTR CALLBACK DlgProcSetupStatusModes(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK DlgProcPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK DlgProcTabConfig(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); -INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); -INT_PTR CALLBACK PlusOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK DlgProcOptions3(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); @@ -272,5 +264,3 @@ int TSAPI RBStateConvert2Flat(int state); void TSAPI FillTabBackground(const HDC hdc, int iStateId, const CTabBaseDlg *dat, RECT* rc); #define IS_EXTKEY(a) (a & (1 << 24)) - -#endif /* __stdafx_H */ diff --git a/plugins/TabSRMM/src/tabctrl.cpp b/plugins/TabSRMM/src/tabctrl.cpp index ca27b71ce8..87098af94a 100644 --- a/plugins/TabSRMM/src/tabctrl.cpp +++ b/plugins/TabSRMM/src/tabctrl.cpp @@ -944,7 +944,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara { WNDCLASSEX wcl = { 0 }; wcl.cbSize = sizeof(wcl); - GetClassInfoEx(g_hInst, L"SysTabControl32", &wcl); + GetClassInfoEx(g_plugin.getInst(), L"SysTabControl32", &wcl); OldTabControlClassProc = wcl.lpfnWndProc; tabdat = (TabControlData*)mir_calloc(sizeof(TabControlData)); diff --git a/plugins/TabSRMM/src/taskbar.cpp b/plugins/TabSRMM/src/taskbar.cpp index 3f5cf35289..7487cd56e2 100644 --- a/plugins/TabSRMM/src/taskbar.cpp +++ b/plugins/TabSRMM/src/taskbar.cpp @@ -214,7 +214,7 @@ CProxyWindow::CProxyWindow(CTabBaseDlg *dat) m_thumb = nullptr; m_hwndProxy = ::CreateWindowEx(/*WS_EX_TOOLWINDOW | */WS_EX_NOACTIVATE, PROXYCLASSNAME, L"", - WS_POPUP | WS_BORDER | WS_SYSMENU | WS_CAPTION, -32000, -32000, 10, 10, nullptr, nullptr, g_hInst, (LPVOID)this); + WS_POPUP | WS_BORDER | WS_SYSMENU | WS_CAPTION, -32000, -32000, 10, 10, nullptr, nullptr, g_plugin.getInst(), (LPVOID)this); #if defined(__LOGDEBUG_) _DebugTraceW(L"create proxy object for: %s", m_dat->cache->getNick()); diff --git a/plugins/TabSRMM/src/taskbar.h b/plugins/TabSRMM/src/taskbar.h index ad29335aed..7e7e030c57 100644 --- a/plugins/TabSRMM/src/taskbar.h +++ b/plugins/TabSRMM/src/taskbar.h @@ -34,7 +34,6 @@ #define __TASKBAR_H #define PROXYCLASSNAME L"TabSRMM_DWMProxy" -extern HINSTANCE g_hInst; class CProxyWindow; @@ -154,7 +153,7 @@ public: */ WNDCLASSEX wcex = { sizeof(wcex) }; wcex.lpfnWndProc = CProxyWindow::stubWndProc; - wcex.hInstance = g_hInst; + wcex.hInstance = g_plugin.getInst(); wcex.hCursor = LoadCursor(nullptr, IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wcex.lpszClassName = PROXYCLASSNAME; @@ -168,7 +167,7 @@ public: m_pTaskbarInterface = nullptr; m_isEnabled = false; } - ::UnregisterClass(PROXYCLASSNAME, g_hInst); + ::UnregisterClass(PROXYCLASSNAME, g_plugin.getInst()); } const LONG getIconSize() const { return m_IconSize; } const bool haveAlwaysGroupingMode() const { return m_fHaveAlwaysGrouping; } diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp index fb7c3ce8c2..0c52cd7f03 100644 --- a/plugins/TabSRMM/src/themes.cpp +++ b/plugins/TabSRMM/src/themes.cpp @@ -2394,7 +2394,7 @@ void CSkin::extractSkinsAndLogo(bool fForceOverwrite) const m_fAeroSkinsValid = true; for (auto &it : my_default_skin) - if (!Utils::extractResource(g_hInst, it.ulID, L"SKIN_GLYPH", tszBasePath, it.tszName, fForceOverwrite)) + if (!Utils::extractResource(g_plugin.getInst(), it.ulID, L"SKIN_GLYPH", tszBasePath, it.tszName, fForceOverwrite)) m_fAeroSkinsValid = false; } diff --git a/plugins/TabSRMM/src/typingnotify.cpp b/plugins/TabSRMM/src/typingnotify.cpp index 1eb3ad1e03..2f6383b2de 100644 --- a/plugins/TabSRMM/src/typingnotify.cpp +++ b/plugins/TabSRMM/src/typingnotify.cpp @@ -492,7 +492,7 @@ int TN_OptionsInitialize(WPARAM wParam, LPARAM) if (ServiceExists(MS_POPUP_ADDPOPUPT)) { OPTIONSDIALOGPAGE odp = { 0 }; odp.position = 100000000; - odp.hInstance = g_hInst; + odp.hInstance = g_plugin.getInst(); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_TYPINGNOTIFYPOPUP); odp.szTitle.a = LPGEN("Typing notify"); odp.szGroup.a = LPGEN("Popups"); diff --git a/plugins/TabSRMM/src/userprefs.cpp b/plugins/TabSRMM/src/userprefs.cpp index 91ec16cc14..65494b062b 100644 --- a/plugins/TabSRMM/src/userprefs.cpp +++ b/plugins/TabSRMM/src/userprefs.cpp @@ -420,14 +420,14 @@ INT_PTR CALLBACK DlgProcUserPrefsFrame(HWND hwndDlg, UINT msg, WPARAM wParam, LP memset(&tci, 0, sizeof(tci)); tci.mask = TCIF_PARAM | TCIF_TEXT; - tci.lParam = (LPARAM)CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_USERPREFS), hwndDlg, DlgProcUserPrefs, hContact); + tci.lParam = (LPARAM)CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_USERPREFS), hwndDlg, DlgProcUserPrefs, hContact); tci.pszText = TranslateT("General"); TabCtrl_InsertItem(GetDlgItem(hwndDlg, IDC_OPTIONSTAB), 0, &tci); MoveWindow((HWND)tci.lParam, 6, DPISCALEY_S(32), rcClient.right - 12, rcClient.bottom - DPISCALEY_S(80), 1); ShowWindow((HWND)tci.lParam, SW_SHOW); EnableThemeDialogTexture((HWND)tci.lParam, ETDT_ENABLETAB); - tci.lParam = (LPARAM)CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_USERPREFS1), hwndDlg, DlgProcUserPrefsLogOptions, hContact); + tci.lParam = (LPARAM)CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_USERPREFS1), hwndDlg, DlgProcUserPrefsLogOptions, hContact); tci.pszText = TranslateT("Message Log"); TabCtrl_InsertItem(GetDlgItem(hwndDlg, IDC_OPTIONSTAB), 1, &tci); MoveWindow((HWND)tci.lParam, 6, DPISCALEY_S(32), rcClient.right - 12, rcClient.bottom - DPISCALEY_S(80), 1); diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp index 16a12bb741..b1bbc3cd48 100644 --- a/plugins/TabSRMM/src/utils.cpp +++ b/plugins/TabSRMM/src/utils.cpp @@ -814,7 +814,7 @@ bool Utils::extractResource(const HMODULE h, const UINT uID, const wchar_t *tszN HGLOBAL hResource = LoadResource(h, hRes); if (hResource) { char *pData = (char *)LockResource(hResource); - DWORD dwSize = SizeofResource(g_hInst, hRes), written = 0; + DWORD dwSize = SizeofResource(g_plugin.getInst(), hRes), written = 0; wchar_t szFilename[MAX_PATH]; mir_snwprintf(szFilename, L"%s%s", tszPath, tszFilename); @@ -968,6 +968,67 @@ void Utils::AddToFileList(wchar_t ***pppFiles, int *totalCount, LPCTSTR szFilena } } +int _DebugTraceW(const wchar_t *fmt, ...) +{ + wchar_t debug[2048]; + int ibsize = 2047; + SYSTEMTIME st; + va_list va; + char tszTime[50]; + va_start(va, fmt); + + GetLocalTime(&st); + + mir_snprintf(tszTime, "%02d.%02d.%04d - %02d:%02d:%02d.%04d: ", st.wDay, st.wMonth, st.wYear, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds); + + + mir_vsnwprintf(debug, ibsize - 10, fmt, va); + //#ifdef _DEBUG + OutputDebugStringW(debug); + //#else + { + char szLogFileName[MAX_PATH], szDataPath[MAX_PATH]; + FILE *f; + + Profile_GetPathA(MAX_PATH, szDataPath); + mir_snprintf(szLogFileName, "%s\\%s", szDataPath, "tabsrmm_debug.log"); + f = fopen(szLogFileName, "a+"); + if (f) { + fputs(tszTime, f); + fputs(T2Utf(debug), f); + fputs("\n", f); + fclose(f); + } + } + //#endif + return 0; +} + +/* +* output a notification message. +* may accept a hContact to include the contacts nickname in the notification message... +* the actual message is using printf() rules for formatting and passing the arguments... +* +* can display the message either as systray notification (baloon popup) or using the +* popup plugin. +*/ +int _DebugPopup(MCONTACT hContact, const wchar_t *fmt, ...) +{ + va_list va; + wchar_t debug[1024]; + int ibsize = 1023; + + va_start(va, fmt); + mir_vsnwprintf(debug, ibsize, fmt, va); + + wchar_t szTitle[128]; + mir_snwprintf(szTitle, TranslateT("TabSRMM message (%s)"), + (hContact != 0) ? Clist_GetContactDisplayName(hContact) : TranslateT("Global")); + + Clist_TrayNotifyW(nullptr, szTitle, debug, NIIF_INFO, 1000 * 4); + return 0; +} + ///////////////////////////////////////////////////////////////////////////////////////// // implementation of the CWarning class // @@ -1021,11 +1082,11 @@ CWarning::~CWarning() LRESULT CWarning::ShowDialog() const { if (!m_fIsModal) { - ::CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_WARNING), nullptr, stubDlgProc, LPARAM(this)); + ::CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_WARNING), nullptr, stubDlgProc, LPARAM(this)); return 0; } - return ::DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_WARNING), nullptr, stubDlgProc, LPARAM(this)); + return ::DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_WARNING), nullptr, stubDlgProc, LPARAM(this)); } __int64 CWarning::getMask() -- cgit v1.2.3