From 28d2449a2207fa8c3f959c8037afe6e869300101 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sat, 21 Sep 2013 18:41:21 +0000 Subject: small cleanup git-svn-id: http://svn.miranda-ng.org/main/trunk@6167 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/core/stdclist/src/cluiopts.cpp | 9 +----- src/core/stduserinfo/contactinfo.cpp | 2 +- src/miranda32_11.vcxproj | 2 +- src/modules/clist/clistmod.cpp | 7 ++--- src/modules/clist/clisttray.cpp | 4 +-- src/modules/clist/clui.cpp | 11 ++++--- src/modules/options/options.cpp | 20 +++++-------- src/modules/utils/hyperlink.cpp | 3 +- src/modules/utils/timezones.cpp | 57 ++++-------------------------------- src/modules/utils/utils.cpp | 9 ------ 10 files changed, 25 insertions(+), 99 deletions(-) diff --git a/src/core/stdclist/src/cluiopts.cpp b/src/core/stdclist/src/cluiopts.cpp index 208accbc05..4552b10015 100644 --- a/src/core/stdclist/src/cluiopts.cpp +++ b/src/core/stdclist/src/cluiopts.cpp @@ -79,14 +79,7 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L } else SetDlgItemTextA(hwndDlg, IDC_TITLETEXT, MIRANDANAME); } - if (!IsWinVer2000Plus()) { - EnableWindow(GetDlgItem(hwndDlg, IDC_FADEINOUT), FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_TRANSPARENT), FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_DROPSHADOW), FALSE); - } - else - CheckDlgButton(hwndDlg, IDC_TRANSPARENT, - db_get_b(NULL, "CList", "Transparent", SETTING_TRANSPARENT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_TRANSPARENT, db_get_b(NULL, "CList", "Transparent", SETTING_TRANSPARENT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); if (!IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)) { EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC11), FALSE); diff --git a/src/core/stduserinfo/contactinfo.cpp b/src/core/stduserinfo/contactinfo.cpp index 21fcb7a203..c74b718e84 100644 --- a/src/core/stduserinfo/contactinfo.cpp +++ b/src/core/stduserinfo/contactinfo.cpp @@ -223,7 +223,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP hEmailFont = CreateFontIndirect(&lf); } if (hHandCursor == NULL) - hHandCursor = ( IsWinVer2000Plus()) ? LoadCursor(NULL, IDC_HAND) : LoadCursor(hInst, MAKEINTRESOURCE(IDC_HYPERLINKHAND)); + hHandCursor = LoadCursor(NULL, IDC_HAND); { LVCOLUMN lvc; RECT rc; diff --git a/src/miranda32_11.vcxproj b/src/miranda32_11.vcxproj index aed9777a24..f54b3df2cd 100644 --- a/src/miranda32_11.vcxproj +++ b/src/miranda32_11.vcxproj @@ -162,7 +162,7 @@ ..\include\msapi - ws2_32.lib;comctl32.lib;winmm.lib;version.lib;UxTheme.lib;%(AdditionalDependencies) + ws2_32.lib;comctl32.lib;winmm.lib;version.lib;UxTheme.lib;Shlwapi.lib;%(AdditionalDependencies) type=%27win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27*%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;type=%27win32%27 name=%27Microsoft.Windows.Gdiplus%27 version=%271.0.0.0%27 processorArchitecture=%27X86%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies) true Windows diff --git a/src/modules/clist/clistmod.cpp b/src/modules/clist/clistmod.cpp index 7d5fb02e43..025f3dfff7 100644 --- a/src/modules/clist/clistmod.cpp +++ b/src/modules/clist/clistmod.cpp @@ -44,7 +44,6 @@ int InitClistHotKeys(void); HANDLE hContactDoubleClicked, hContactIconChangedEvent; HIMAGELIST hCListImages; -BOOL(WINAPI * MySetProcessWorkingSetSize) (HANDLE, SIZE_T, SIZE_T); extern BYTE nameOrder[]; @@ -414,8 +413,8 @@ int fnShowHide(WPARAM, LPARAM) db_set_b(NULL, "CList", "State", SETTING_STATE_MINIMIZED); } - if (MySetProcessWorkingSetSize != NULL && db_get_b(NULL, "CList", "DisableWorkingSet", 1)) - MySetProcessWorkingSetSize(GetCurrentProcess(), -1, -1); + if (db_get_b(NULL, "CList", "DisableWorkingSet", 1)) + SetProcessWorkingSetSize(GetCurrentProcess(), -1, -1); } return 0; } @@ -511,8 +510,6 @@ int LoadContactListModule2(void) CreateServiceFunction(MS_CLIST_HOTKEYSPROCESSMESSAGE, HotkeysProcessMessageStub); CreateServiceFunction(MS_CLIST_GETCONTACTICON, GetContactIcon); - MySetProcessWorkingSetSize = (BOOL(WINAPI *) (HANDLE, SIZE_T, SIZE_T)) GetProcAddress(GetModuleHandleA("kernel32"), "SetProcessWorkingSetSize"); - InitDisplayNameCache(); InitCListEvents(); InitGroupServices(); diff --git a/src/modules/clist/clisttray.cpp b/src/modules/clist/clisttray.cpp index 321ceb54d1..4c26df5b25 100644 --- a/src/modules/clist/clisttray.cpp +++ b/src/modules/clist/clisttray.cpp @@ -27,7 +27,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define TOOLTIP_TOLERANCE 5 extern HIMAGELIST hCListImages; -extern BOOL(WINAPI * MySetProcessWorkingSetSize) (HANDLE, SIZE_T, SIZE_T); int GetAverageMode(int* pNetProtoCount = NULL); @@ -590,8 +589,7 @@ static VOID CALLBACK TrayIconAutoHideTimer(HWND hwnd, UINT, UINT_PTR idEvent, DW HWND hwndClui = cli.hwndContactList; if (GetActiveWindow() != hwndClui) { ShowWindow(hwndClui, SW_HIDE); - if (MySetProcessWorkingSetSize != NULL) - MySetProcessWorkingSetSize(GetCurrentProcess(), -1, -1); + SetProcessWorkingSetSize(GetCurrentProcess(), -1, -1); } } diff --git a/src/modules/clist/clui.cpp b/src/modules/clist/clui.cpp index e03d2daf18..af5b739943 100644 --- a/src/modules/clist/clui.cpp +++ b/src/modules/clist/clui.cpp @@ -28,7 +28,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define TM_AUTOALPHA 1 #define MENU_MIRANDAMENU 0xFFFF1234 -extern BOOL(WINAPI * MySetProcessWorkingSetSize) (HANDLE, SIZE_T, SIZE_T); extern HANDLE hEventExtraClick; static HMODULE hUserDll; @@ -546,8 +545,8 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM } else db_set_b(NULL, "CList", "State", SETTING_STATE_MINIMIZED); - if (MySetProcessWorkingSetSize != NULL && db_get_b(NULL, "CList", "DisableWorkingSet", 1)) - MySetProcessWorkingSetSize(GetCurrentProcess(), -1, -1); + if (db_get_b(NULL, "CList", "DisableWorkingSet", 1)) + SetProcessWorkingSetSize(GetCurrentProcess(), -1, -1); } // drop thru case WM_MOVE: @@ -639,7 +638,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break; if (noRecurse) break; - if ( !db_get_b(NULL, "CLUI", "FadeInOut", 0) || !IsWinVer2000Plus()) + if ( !db_get_b(NULL, "CLUI", "FadeInOut", 0)) break; if (GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_LAYERED) { DWORD thisTick, startTick; @@ -696,8 +695,8 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM ShowWindow(hwnd, SW_HIDE); db_set_b(NULL, "CList", "State", SETTING_STATE_HIDDEN); - if (MySetProcessWorkingSetSize != NULL && db_get_b(NULL, "CList", "DisableWorkingSet", 1)) - MySetProcessWorkingSetSize(GetCurrentProcess(), -1, -1); + if (db_get_b(NULL, "CList", "DisableWorkingSet", 1)) + SetProcessWorkingSetSize(GetCurrentProcess(), -1, -1); return 0; } diff --git a/src/modules/options/options.cpp b/src/modules/options/options.cpp index 6f19035d1e..04daab9bb2 100644 --- a/src/modules/options/options.cpp +++ b/src/modules/options/options.cpp @@ -652,18 +652,14 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L TCHAR *lastPage = NULL, *lastGroup = NULL, *lastTab = NULL; DBVARIANT dbv; - typedef BOOL (STDAPICALLTYPE *pfnGetComboBoxInfo)(HWND, PCOMBOBOXINFO); - pfnGetComboBoxInfo getComboBoxInfo = (pfnGetComboBoxInfo)GetProcAddress(GetModuleHandleA("user32"), "GetComboBoxInfo"); - if (getComboBoxInfo) { - COMBOBOXINFO cbi; - cbi.cbSize = sizeof(COMBOBOXINFO); - getComboBoxInfo( GetDlgItem(hdlg, IDC_KEYWORD_FILTER), &cbi); - mir_subclassWindow(cbi.hwndItem, OptionsFilterSubclassProc); - - if (IsAeroMode()) { - mir_subclassWindow(cbi.hwndCombo, AeroPaintSubclassProc); - mir_subclassWindow(cbi.hwndItem, AeroPaintSubclassProc); - } + COMBOBOXINFO cbi; + cbi.cbSize = sizeof(COMBOBOXINFO); + GetComboBoxInfo( GetDlgItem(hdlg, IDC_KEYWORD_FILTER), &cbi); + mir_subclassWindow(cbi.hwndItem, OptionsFilterSubclassProc); + + if (IsAeroMode()) { + mir_subclassWindow(cbi.hwndCombo, AeroPaintSubclassProc); + mir_subclassWindow(cbi.hwndItem, AeroPaintSubclassProc); } Utils_RestoreWindowPositionNoSize(hdlg, NULL, "Options", ""); diff --git a/src/modules/utils/hyperlink.cpp b/src/modules/utils/hyperlink.cpp index 1fd17b8130..23f7e151cb 100644 --- a/src/modules/utils/hyperlink.cpp +++ b/src/modules/utils/hyperlink.cpp @@ -260,8 +260,7 @@ int InitHyperlink(void) wcl.cbClsExtra = 0; wcl.cbWndExtra = sizeof(struct HyperlinkWndData*); wcl.hInstance = hInst; - if (IsWinVer2000Plus()) wcl.hCursor = NULL; - else wcl.hCursor = LoadCursor(wcl.hInstance, MAKEINTRESOURCE(IDC_HYPERLINKHAND)); + wcl.hCursor = NULL; wcl.lpszClassName = WNDCLASS_HYPERLINK; wcl.hbrBackground = NULL; wcl.hIcon = NULL; diff --git a/src/modules/utils/timezones.cpp b/src/modules/utils/timezones.cpp index f5f3c15291..6fb8571823 100644 --- a/src/modules/utils/timezones.cpp +++ b/src/modules/utils/timezones.cpp @@ -30,18 +30,6 @@ TIME_API tmi; typedef DWORD (WINAPI *pfnGetDynamicTimeZoneInformation_t)(DYNAMIC_TIME_ZONE_INFORMATION *pdtzi); static pfnGetDynamicTimeZoneInformation_t pfnGetDynamicTimeZoneInformation; -typedef HRESULT (WINAPI *pfnSHLoadIndirectString_t)(LPCWSTR pszSource, LPWSTR pszOutBuf, UINT cchOutBuf, void **ppvReserved); -static pfnSHLoadIndirectString_t pfnSHLoadIndirectString; - -typedef LANGID (WINAPI *pfnGetUserDefaultUILanguage_t)(void); -static pfnGetUserDefaultUILanguage_t pfnGetUserDefaultUILanguage; - -typedef LANGID (WINAPI *pfnGetSystemDefaultUILanguage_t)(void); -static pfnGetSystemDefaultUILanguage_t pfnGetSystemDefaultUILanguage; - -typedef LPARAM (WINAPI *pfnSendMessageW_t)(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); -static pfnSendMessageW_t pfnSendMessageW; - typedef struct _REG_TZI_FORMAT { LONG Bias; @@ -74,7 +62,6 @@ typedef struct } TZ_INT_INFO; static TZ_INT_INFO myInfo; -bool muiInstalled; static OBJLIST g_timezones(55, NumericKeySortT); static LIST g_timezonesBias(55, MIM_TIMEZONE::compareBias); @@ -411,11 +398,7 @@ static int timeapiPrepareList(HANDLE hContact, HWND hWnd, DWORD dwFlags) { MIM_TIMEZONE *tz = g_timezonesBias[i]; - if (pfnSendMessageW) - pfnSendMessageW(hWnd, lstMsg->addStr, 0, (LPARAM)tz->szDisplay); - else - SendMessage(hWnd, lstMsg->addStr, 0, (LPARAM)StrConvTu(tz->szDisplay)); - + SendMessage(hWnd, lstMsg->addStr, 0, (LPARAM)tz->szDisplay); SendMessage(hWnd, lstMsg->setData, i + 1, (LPARAM)tz); } @@ -496,27 +479,9 @@ static INT_PTR TimestampToStringA(WPARAM wParam, LPARAM lParam) void GetLocalizedString(HKEY hSubKey, const TCHAR *szName, wchar_t *szBuf, DWORD cbLen) { - szBuf[0] = 0; - if (muiInstalled) - { - TCHAR tszTempBuf[MIM_TZ_NAMELEN], tszName[30]; - mir_sntprintf(tszName, SIZEOF(tszName), _T("MUI_%s"), szName); - DWORD dwLength = cbLen * sizeof(TCHAR); - if (ERROR_SUCCESS == RegQueryValueEx(hSubKey, tszName, NULL, NULL, (unsigned char *)tszTempBuf, &dwLength)) - { - tszTempBuf[min(dwLength / sizeof(TCHAR), cbLen - 1)] = 0; - if (pfnSHLoadIndirectString) - pfnSHLoadIndirectString(StrConvU(tszTempBuf), szBuf, cbLen, NULL); - } - } - if (szBuf[0] == 0) - { - DWORD dwLength = cbLen * sizeof(wchar_t); - - - RegQueryValueEx(hSubKey, szName, NULL, NULL, (unsigned char *)szBuf, &dwLength); - szBuf[min(dwLength / sizeof(TCHAR), cbLen - 1)] = 0; - } + DWORD dwLength = cbLen * sizeof(wchar_t); + RegQueryValueEx(hSubKey, szName, NULL, NULL, (unsigned char *)szBuf, &dwLength); + szBuf[min(dwLength / sizeof(TCHAR), cbLen - 1)] = 0; } extern "C" __declspec(dllexport) void RecalculateTime(void) @@ -558,9 +523,7 @@ void InitTimeZones(void) REG_TZI_FORMAT tzi; HKEY hKey; - const TCHAR *tszKey = IsWinVerNT() ? - _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones") : - _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Time Zones"); + const TCHAR *tszKey = _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones"); /* * use GetDynamicTimeZoneInformation() on Vista+ - this will return a structure with @@ -570,16 +533,6 @@ void InitTimeZones(void) if (IsWinVerVistaPlus()) pfnGetDynamicTimeZoneInformation = (pfnGetDynamicTimeZoneInformation_t)GetProcAddress(GetModuleHandle(_T("kernel32")), "GetDynamicTimeZoneInformation"); - if (IsWinVer2000Plus()) - { - pfnSHLoadIndirectString = (pfnSHLoadIndirectString_t)GetProcAddress(GetModuleHandle(_T("shlwapi")), "SHLoadIndirectString"); - pfnGetSystemDefaultUILanguage = (pfnGetSystemDefaultUILanguage_t)GetProcAddress(GetModuleHandle(_T("kernel32")), "GetSystemDefaultUILanguage"); - pfnGetUserDefaultUILanguage = (pfnGetUserDefaultUILanguage_t)GetProcAddress(GetModuleHandle(_T("kernel32")), "GetUserDefaultUILanguage"); - muiInstalled = pfnSHLoadIndirectString && pfnGetSystemDefaultUILanguage() != pfnGetUserDefaultUILanguage(); - } - - pfnSendMessageW = (pfnSendMessageW_t)GetProcAddress(GetModuleHandle(_T("user32")), "SendMessageW"); - if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, tszKey, 0, KEY_ENUMERATE_SUB_KEYS, &hKey)) { DWORD dwIndex = 0; diff --git a/src/modules/utils/utils.cpp b/src/modules/utils/utils.cpp index ddf2038da0..62322a9ec6 100644 --- a/src/modules/utils/utils.cpp +++ b/src/modules/utils/utils.cpp @@ -448,15 +448,6 @@ static INT_PTR GenerateRandom(WPARAM wParam, LPARAM lParam) pfnRtlGenRandom = NULL; } } - if (pfnRtlGenRandom == NULL) - { - srand(GetTickCount()); - unsigned short* buf = (unsigned short*)lParam; - for (; (long)(wParam-=2) >= 0;) - *(buf++) = (unsigned short)rand(); - if (lParam < 0) - *(char*)buf = (char)(rand() & 0xFF); - } return 0; } -- cgit v1.2.3