diff options
author | George Hazan <ghazan@miranda.im> | 2019-03-02 12:32:44 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-03-02 12:32:55 +0300 |
commit | 931a7dc1ac0dbc7e6c1083583ced915e572f5b47 (patch) | |
tree | 9fe9a6448d44030e26aa7107ce16044ed413e0d0 /protocols/CurrencyRates/src/WinCtrlHelper.h | |
parent | dd7d9954042254e66e3bbbec7195c6be8b1a0663 (diff) |
all protocols (even virtual ones) moved to the Protocols folder
Diffstat (limited to 'protocols/CurrencyRates/src/WinCtrlHelper.h')
-rw-r--r-- | protocols/CurrencyRates/src/WinCtrlHelper.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/protocols/CurrencyRates/src/WinCtrlHelper.h b/protocols/CurrencyRates/src/WinCtrlHelper.h new file mode 100644 index 0000000000..a770072bd6 --- /dev/null +++ b/protocols/CurrencyRates/src/WinCtrlHelper.h @@ -0,0 +1,37 @@ +#ifndef __a05d6852_4497_4f28_85e1_48a15a170738_WinCtrlHelper_h__ +#define __a05d6852_4497_4f28_85e1_48a15a170738_WinCtrlHelper_h__ + +class ICurrencyRatesProvider; + +inline tstring get_window_text(HWND hWnd) +{ + int cBytes = ::GetWindowTextLength(hWnd); + + std::vector<wchar_t> aBuf(cBytes + 1); + LPTSTR pBuffer = &*(aBuf.begin()); + ::GetWindowText(hWnd, pBuffer, cBytes + 1); + + return tstring(pBuffer); +} + +inline void prepare_edit_ctrl_for_error(HWND hwndEdit) +{ + ::SetFocus(hwndEdit); + ::SendMessage(hwndEdit, EM_SETSEL, 0, -1); + ::SendMessage(hwndEdit, EM_SCROLLCARET, 0, 0); +} + +void show_variable_list(HWND hwndParent, const ICurrencyRatesProvider *pProvider); + +inline int CurrencyRates_MessageBox(HWND hWnd, LPCTSTR pszText, UINT nType = MB_OK) +{ + return ::MessageBox(hWnd, pszText, currencyrates_a2t(MIRANDANAME).c_str(), nType); +} + +inline void spin_set_range(HWND hwndSpin, short nLower, short nUpper) +{ + ::SendMessage(hwndSpin, UDM_SETRANGE, 0, MAKELPARAM(nUpper, nLower)); +} + + +#endif //__a05d6852_4497_4f28_85e1_48a15a170738_WinCtrlHelper_h__ |