[RAPPS_NEW][EXPLORER][RSHELL][BROWSEUI]

- Use ATL::CWindow methods where appropriate. By Benedikt Freisen.
CORE-9675 #resolve

svn path=/trunk/; revision=68361
This commit is contained in:
Thomas Faber 2015-07-06 19:38:22 +00:00
parent 49363e72c9
commit c77efa29ff
8 changed files with 46 additions and 47 deletions

View file

@ -949,7 +949,7 @@ private:
WCHAR szWndText[MAX_STR_LEN]; WCHAR szWndText[MAX_STR_LEN];
LoadStringW(hInst, IDS_SEARCH_TEXT, szBuf, _countof(szBuf)); LoadStringW(hInst, IDS_SEARCH_TEXT, szBuf, _countof(szBuf));
::GetWindowTextW(m_SearchBar->m_hWnd, szWndText, MAX_STR_LEN); m_SearchBar->GetWindowTextW(szWndText, MAX_STR_LEN);
if (wcscmp(szBuf, szWndText) == 0) if (wcscmp(szBuf, szWndText) == 0)
{ {
SearchEnabled = FALSE; SearchEnabled = FALSE;
@ -960,7 +960,7 @@ private:
case EN_KILLFOCUS: case EN_KILLFOCUS:
{ {
::GetWindowTextW(m_SearchBar->m_hWnd, szBuf, MAX_STR_LEN); m_SearchBar->GetWindowTextW(szBuf, MAX_STR_LEN);
if (wcslen(szBuf) < 1) if (wcslen(szBuf) < 1)
{ {
LoadStringW(hInst, IDS_SEARCH_TEXT, szBuf, _countof(szBuf)); LoadStringW(hInst, IDS_SEARCH_TEXT, szBuf, _countof(szBuf));
@ -981,7 +981,7 @@ private:
} }
LoadStringW(hInst, IDS_SEARCH_TEXT, szBuf, _countof(szBuf)); LoadStringW(hInst, IDS_SEARCH_TEXT, szBuf, _countof(szBuf));
::GetWindowTextW(m_SearchBar->m_hWnd, szWndText, MAX_STR_LEN); m_SearchBar->GetWindowTextW(szWndText, MAX_STR_LEN);
if (wcscmp(szBuf, szWndText) != 0) if (wcscmp(szBuf, szWndText) != 0)
{ {
StringCbCopy(szSearchPattern, sizeof(szSearchPattern), StringCbCopy(szSearchPattern, sizeof(szSearchPattern),
@ -1019,7 +1019,7 @@ private:
break; break;
case ID_EXIT: case ID_EXIT:
::PostMessageW(m_hWnd, WM_CLOSE, 0, 0); PostMessageW(WM_CLOSE, 0, 0);
break; break;
case ID_INSTALL: case ID_INSTALL:
@ -1054,7 +1054,7 @@ private:
break; break;
case ID_HELP: case ID_HELP:
::MessageBoxW(m_hWnd, L"Help not implemented yet", NULL, MB_OK); MessageBoxW(L"Help not implemented yet", NULL, MB_OK);
break; break;
case ID_ABOUT: case ID_ABOUT:

View file

@ -668,7 +668,7 @@ public:
if (hDwp) if (hDwp)
{ {
return ::DeferWindowPos(hDwp, m_hWnd, NULL, return DeferWindowPos(hDwp, NULL,
splitter.left, splitter.top, splitter.left, splitter.top,
splitter.right - splitter.left, splitter.right - splitter.left,
splitter.bottom - splitter.top, splitter.bottom - splitter.top,

View file

@ -1790,7 +1790,7 @@ public:
RECT* prcMinRect = (RECT*) lParam; RECT* prcMinRect = (RECT*) lParam;
RECT rcItem, rcToolbar; RECT rcItem, rcToolbar;
m_TaskBar.GetItemRect(TaskItem->Index, &rcItem); m_TaskBar.GetItemRect(TaskItem->Index, &rcItem);
::GetWindowRect(m_TaskBar.m_hWnd, &rcToolbar); m_TaskBar.GetWindowRect(&rcToolbar);
OffsetRect(&rcItem, rcToolbar.left, rcToolbar.top); OffsetRect(&rcItem, rcToolbar.left, rcToolbar.top);

View file

@ -345,7 +345,7 @@ private:
POINT ptItem = { rcItem.left, rcItem.top }; POINT ptItem = { rcItem.left, rcItem.top };
SIZE szItem = { rcItem.right - rcItem.left, rcItem.bottom - rcItem.top }; SIZE szItem = { rcItem.right - rcItem.left, rcItem.bottom - rcItem.top };
::ClientToScreen(m_hWnd, &ptItem); ClientToScreen(&ptItem);
ptItem.x += szItem.cx / 2; ptItem.x += szItem.cx / 2;
ptItem.y -= szTip.cy; ptItem.y -= szTip.cy;
@ -732,7 +732,7 @@ public:
INT c, i; INT c, i;
BOOL bRet = TRUE; BOOL bRet = TRUE;
hDC = ::GetDC(m_hWnd); hDC = GetDC();
if (hDC != NULL) if (hDC != NULL)
{ {
if (hFont) if (hFont)
@ -752,7 +752,7 @@ public:
if (hFont) if (hFont)
SelectObject(hDC, hPrevFont); SelectObject(hDC, hPrevFont);
::ReleaseDC(m_hWnd, hDC); ReleaseDC(hDC);
if (bRet) if (bRet)
{ {
@ -895,7 +895,7 @@ public:
CurrentSize = szWnd; CurrentSize = szWnd;
} }
if (::IsWindowVisible(m_hWnd)) if (IsWindowVisible())
{ {
InvalidateRect(NULL, TRUE); InvalidateRect(NULL, TRUE);
@ -906,7 +906,7 @@ public:
NMHDR nmh; NMHDR nmh;
nmh.hwndFrom = m_hWnd; nmh.hwndFrom = m_hWnd;
nmh.idFrom = ::GetWindowLongPtr(m_hWnd, GWLP_ID); nmh.idFrom = GetWindowLongPtr(GWLP_ID);
nmh.code = NTNWM_REALIGN; nmh.code = NTNWM_REALIGN;
SendMessage(hWndNotify, SendMessage(hWndNotify,
@ -1497,10 +1497,10 @@ public:
BOOL GetClockRect(OUT PRECT rcClock) BOOL GetClockRect(OUT PRECT rcClock)
{ {
if (!::IsWindowVisible(m_clock->m_hWnd)) if (!m_clock->IsWindowVisible())
return FALSE; return FALSE;
return ::GetWindowRect(m_clock->m_hWnd, rcClock); return m_clock->GetWindowRect(rcClock);
} }
LRESULT OnGetMinimumSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) LRESULT OnGetMinimumSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)

View file

@ -882,7 +882,7 @@ GetPrimaryScreenRect:
m_TrayRects[m_Position] = rcTray; m_TrayRects[m_Position] = rcTray;
goto ChangePos; goto ChangePos;
} }
else if (::GetWindowRect(m_hWnd, &rcTray)) else if (GetWindowRect(&rcTray))
{ {
if (InSizeMove) if (InSizeMove)
{ {
@ -952,7 +952,7 @@ ChangePos:
RECT rcClip, rcWindow; RECT rcClip, rcWindow;
HRGN hClipRgn; HRGN hClipRgn;
if (::GetWindowRect(m_hWnd, &rcWindow)) if (GetWindowRect(&rcWindow))
{ {
/* Disable clipping on systems with only one monitor */ /* Disable clipping on systems with only one monitor */
if (GetSystemMetrics(SM_CMONITORS) <= 1) if (GetSystemMetrics(SM_CMONITORS) <= 1)
@ -980,7 +980,7 @@ ChangePos:
/* Set the clipping region or make sure the window isn't clipped /* Set the clipping region or make sure the window isn't clipped
by disabling it explicitly. */ by disabling it explicitly. */
::SetWindowRgn(m_hWnd, hClipRgn, TRUE); SetWindowRgn(hClipRgn, TRUE);
} }
} }
@ -1215,7 +1215,7 @@ ChangePos:
{ {
if (ptmp == NULL && if (ptmp == NULL &&
GetClientRect(&tmp.rcExclude) && GetClientRect(&tmp.rcExclude) &&
::MapWindowPoints(m_hWnd, MapWindowPoints(
NULL, NULL,
(LPPOINT) &tmp.rcExclude, (LPPOINT) &tmp.rcExclude,
2) != 0) 2) != 0)
@ -1344,14 +1344,13 @@ ChangePos:
if (m_StartButton.m_hWnd != NULL) if (m_StartButton.m_hWnd != NULL)
{ {
/* Resize and reposition the button */ /* Resize and reposition the button */
dwp = ::DeferWindowPos(dwp, dwp = m_StartButton.DeferWindowPos(dwp,
m_StartButton.m_hWnd, NULL,
NULL, 0,
0, 0,
0, StartSize.cx,
StartSize.cx, StartSize.cy,
StartSize.cy, SWP_NOZORDER | SWP_NOACTIVATE);
SWP_NOZORDER | SWP_NOACTIVATE);
if (dwp == NULL) if (dwp == NULL)
{ {
ERR("DeferWindowPos for start button failed. lastErr=%d\n", GetLastError()); ERR("DeferWindowPos for start button failed. lastErr=%d\n", GetLastError());
@ -1586,7 +1585,7 @@ ChangePos:
If it was somehow destroyed just create a new tray window. */ If it was somehow destroyed just create a new tray window. */
if (m_hWnd != NULL && IsWindow()) if (m_hWnd != NULL && IsWindow())
{ {
if (!::IsWindowVisible(m_hWnd)) if (!IsWindowVisible())
{ {
CheckTrayWndPosition(); CheckTrayWndPosition();
@ -1656,7 +1655,7 @@ ChangePos:
HWND hwnd; HWND hwnd;
RECT posRect; RECT posRect;
::GetWindowRect(m_StartButton.m_hWnd, &posRect); m_StartButton.GetWindowRect(&posRect);
hwnd = CreateWindowEx(0, hwnd = CreateWindowEx(0,
WC_STATIC, WC_STATIC,
NULL, NULL,
@ -1886,10 +1885,10 @@ ChangePos:
RECT rect; RECT rect;
int backoundPart; int backoundPart;
::GetWindowRect(m_hWnd, &rect); GetWindowRect(&rect);
OffsetRect(&rect, -rect.left, -rect.top); OffsetRect(&rect, -rect.left, -rect.top);
hdc = ::GetDCEx(m_hWnd, hRgn, DCX_WINDOW | DCX_INTERSECTRGN | DCX_PARENTCLIP); hdc = GetDCEx(hRgn, DCX_WINDOW | DCX_INTERSECTRGN | DCX_PARENTCLIP);
switch (m_Position) switch (m_Position)
{ {
@ -1917,7 +1916,7 @@ ChangePos:
} }
DrawThemeBackground(m_Theme, hdc, backoundPart, 0, &rect, 0); DrawThemeBackground(m_Theme, hdc, backoundPart, 0, &rect, 0);
::ReleaseDC(m_hWnd, hdc); ReleaseDC(hdc);
return 0; return 0;
} }
@ -1926,7 +1925,7 @@ ChangePos:
HWND hwnd; HWND hwnd;
RECT posRect; RECT posRect;
::GetWindowRect(m_StartButton.m_hWnd, &posRect); m_StartButton.GetWindowRect(&posRect);
hwnd = CreateWindowEx(0, hwnd = CreateWindowEx(0,
WC_STATIC, WC_STATIC,
@ -1982,7 +1981,7 @@ ChangePos:
RECTL rcExclude; RECTL rcExclude;
DWORD dwFlags = 0; DWORD dwFlags = 0;
if (::GetWindowRect(m_StartButton.m_hWnd, (RECT*) &rcExclude)) if (m_StartButton.GetWindowRect((RECT*) &rcExclude))
{ {
switch (m_Position) switch (m_Position)
{ {
@ -2023,7 +2022,7 @@ ChangePos:
UINT state = m_AutoHideState; UINT state = m_AutoHideState;
GetCursorPos(&pt); GetCursorPos(&pt);
::GetWindowRect(m_hWnd, &rcCurrent); GetWindowRect(&rcCurrent);
over = PtInRect(&rcCurrent, pt); over = PtInRect(&rcCurrent, pt);
if (m_StartButton.SendMessage( BM_GETSTATE, 0, 0) != BST_UNCHECKED) if (m_StartButton.SendMessage( BM_GETSTATE, 0, 0) != BST_UNCHECKED)
@ -2243,7 +2242,7 @@ ChangePos:
SetLastError(ERROR_SUCCESS); SetLastError(ERROR_SUCCESS);
if (GetClientRect(&rcClient) && if (GetClientRect(&rcClient) &&
(::MapWindowPoints(m_hWnd, NULL, (LPPOINT) &rcClient, 2) != 0 || GetLastError() == ERROR_SUCCESS)) (MapWindowPoints(NULL, (LPPOINT) &rcClient, 2) != 0 || GetLastError() == ERROR_SUCCESS))
{ {
pt.x = (SHORT) LOWORD(lParam); pt.x = (SHORT) LOWORD(lParam);
pt.y = (SHORT) HIWORD(lParam); pt.y = (SHORT) HIWORD(lParam);
@ -2386,7 +2385,7 @@ ChangePos:
if (!Locked) if (!Locked)
{ {
/* Apply clipping */ /* Apply clipping */
::PostMessage(m_hWnd, WM_SIZE, SIZE_RESTORED, 0); PostMessage(WM_SIZE, SIZE_RESTORED, 0);
} }
return TRUE; return TRUE;
} }
@ -2415,7 +2414,7 @@ ChangePos:
/* temporarily enable the system menu */ /* temporarily enable the system menu */
SetWindowStyle(m_hWnd, WS_SYSMENU, WS_SYSMENU); SetWindowStyle(m_hWnd, WS_SYSMENU, WS_SYSMENU);
hSysMenu = ::GetSystemMenu(m_hWnd, FALSE); hSysMenu = GetSystemMenu(FALSE);
if (hSysMenu != NULL) if (hSysMenu != NULL)
{ {
/* Disable all items that are not relevant */ /* Disable all items that are not relevant */
@ -2505,7 +2504,7 @@ ChangePos:
/* Convert the coordinates to client-coordinates */ /* Convert the coordinates to client-coordinates */
::MapWindowPoints(NULL, m_hWnd, &ptClient, 1); ::MapWindowPoints(NULL, m_hWnd, &ptClient, 1);
hWndAtPt = ::ChildWindowFromPoint(m_hWnd, ptClient); hWndAtPt = ChildWindowFromPoint(ptClient);
if (hWndAtPt != NULL && if (hWndAtPt != NULL &&
(hWndAtPt == m_Rebar || ::IsChild(m_Rebar, hWndAtPt))) (hWndAtPt == m_Rebar || ::IsChild(m_Rebar, hWndAtPt)))
{ {
@ -2561,7 +2560,7 @@ HandleTrayContextMenu:
{ {
case NTNWM_REALIGN: case NTNWM_REALIGN:
/* Cause all controls to be aligned */ /* Cause all controls to be aligned */
::PostMessage(m_hWnd, WM_SIZE, SIZE_RESTORED, 0); PostMessage(WM_SIZE, SIZE_RESTORED, 0);
break; break;
} }
} }

View file

@ -700,8 +700,8 @@ HRESULT CMenuToolbarBase::PopupSubMenu(UINT iItem, UINT index, IShellMenu* child
POINT a = { rc.left, rc.top }; POINT a = { rc.left, rc.top };
POINT b = { rc.right, rc.bottom }; POINT b = { rc.right, rc.bottom };
::ClientToScreen(m_hWnd, &a); ClientToScreen(&a);
::ClientToScreen(m_hWnd, &b); ClientToScreen(&b);
POINTL pt = { a.x, b.y }; POINTL pt = { a.x, b.y };
RECTL rcl = { a.x, a.y, b.x, b.y }; RECTL rcl = { a.x, a.y, b.x, b.y };
@ -741,8 +741,8 @@ HRESULT CMenuToolbarBase::PopupSubMenu(UINT iItem, UINT index, HMENU menu)
POINT a = { rc.left, rc.top }; POINT a = { rc.left, rc.top };
POINT b = { rc.right, rc.bottom }; POINT b = { rc.right, rc.bottom };
::ClientToScreen(m_hWnd, &a); ClientToScreen(&a);
::ClientToScreen(m_hWnd, &b); ClientToScreen(&b);
POINT pt = { a.x, b.y }; POINT pt = { a.x, b.y };
RECT rcl = { a.x, a.y, b.x, b.y }; RECT rcl = { a.x, a.y, b.x, b.y };
@ -937,7 +937,7 @@ HRESULT CMenuToolbarBase::KeyboardItemChange(DWORD dwSelectType)
HWND tlw; HWND tlw;
m_menuBand->_GetTopLevelWindow(&tlw); m_menuBand->_GetTopLevelWindow(&tlw);
SendMessageW(tlw, WM_CANCELMODE, 0, 0); SendMessageW(tlw, WM_CANCELMODE, 0, 0);
::PostMessageW(m_hWnd, WM_USER_CHANGETRACKEDITEM, index, MAKELPARAM(m_isTrackingPopup, FALSE)); PostMessageW(WM_USER_CHANGETRACKEDITEM, index, MAKELPARAM(m_isTrackingPopup, FALSE));
} }
else else
m_menuBand->_ChangeHotItem(this, btn.idCommand, 0); m_menuBand->_ChangeHotItem(this, btn.idCommand, 0);

View file

@ -108,10 +108,10 @@ HRESULT STDMETHODCALLTYPE CAddressEditBox::ParseNow(long paramC)
return hr; return hr;
LPWSTR input; LPWSTR input;
int inputLength = ::GetWindowTextLength(fCombobox.m_hWnd) + 2; int inputLength = fCombobox.GetWindowTextLength() + 2;
input = new WCHAR[inputLength]; input = new WCHAR[inputLength];
::GetWindowText(fCombobox.m_hWnd, input, inputLength); fCombobox.GetWindowText(input, inputLength);
LPWSTR address; LPWSTR address;
int addressLength = ExpandEnvironmentStrings(input, NULL, 0); int addressLength = ExpandEnvironmentStrings(input, NULL, 0);

View file

@ -1841,7 +1841,7 @@ LRESULT CInternetToolbar::OnLDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL
fStartPosition.y = GET_Y_LPARAM(msgp); fStartPosition.y = GET_Y_LPARAM(msgp);
RECT rc; RECT rc;
::GetWindowRect(m_hWnd, &rc); GetWindowRect(&rc);
fStartHeight = rc.bottom - rc.top; fStartHeight = rc.bottom - rc.top;