HWND GetNextDlgGroupItem( HWND hwndDlg, HWND hwndCtl, BOOL bPrevious) { PWND pwndDlg; PWND pwndCtl; PWND pwndNext; pwndDlg = ValidateHwnd(hwndDlg); if (pwndDlg == NULL) return 0; if (hwndCtl != (HWND)0) { pwndCtl = ValidateHwnd(hwndCtl); if (pwndCtl == NULL) return 0; } else { pwndCtl = (PWND)NULL; } if (pwndCtl == pwndDlg) pwndCtl = pwndDlg; pwndNext = _GetNextDlgGroupItem(pwndDlg, pwndCtl, bPrevious); return (HW(pwndNext)); }
HWND WINAPI GetNextDlgTabItem( HWND hwndDlg, HWND hwnd, BOOL fPrev) { PWND pwnd; PWND pwndDlg; PWND pwndNext; pwndDlg = ValidateHwnd(hwndDlg); if (pwndDlg == NULL) return NULL; if (hwnd != (HWND)0) { pwnd = ValidateHwnd(hwnd); if (pwnd == NULL) return NULL; } else { pwnd = (PWND)NULL; } pwndNext = _GetNextDlgTabItem(pwndDlg, pwnd, fPrev); return (HW(pwndNext)); }
LRESULT DefWndNCActivate(HWND hWnd, WPARAM wParam, LPARAM lParam) { PWND Wnd = ValidateHwnd(hWnd); if (!Wnd) return 0; /* Lotus Notes draws menu descriptions in the caption of its main * window. When it wants to restore original "system" view, it just * sends WM_NCACTIVATE message to itself. Any optimizations here in * attempt to minimize redrawings lead to a not restored caption. */ if (wParam) NtUserxSetWindowState(Wnd, WNDSACTIVEFRAME); else NtUserxClearWindowState(Wnd, WNDSACTIVEFRAME); if (Wnd->state & WNDS_NONCPAINT) return 0; /* This isn't documented but is reproducible in at least XP SP2 and * Outlook 2007 depends on it */ // MSDN: // If this parameter is set to -1, DefWindowProc does not repaint the // nonclient area to reflect the state change. if (lParam != -1) { DefWndNCPaint(hWnd, HRGN_WINDOW, wParam); } return TRUE; }
HANDLE FASTCALL IntGetProp(HWND hWnd, ATOM Atom) { PLIST_ENTRY ListEntry, temp; PPROPERTY Property; PWND pWnd; int i; pWnd = ValidateHwnd(hWnd); if (!pWnd) return NULL; ListEntry = SharedPtrToUser(pWnd->PropListHead.Flink); for (i = 0; i < pWnd->PropListItems; i++ ) { Property = CONTAINING_RECORD(ListEntry, PROPERTY, PropListEntry); if (Property->Atom == Atom) { return(Property); } temp = ListEntry->Flink; ListEntry = SharedPtrToUser(temp); } return NULL; }
WORD GetClassWord( HWND hwnd, int index) { PWND pwnd; PCLS pclsClient; pwnd = ValidateHwnd(hwnd); if (pwnd == NULL) return 0; pclsClient = (PCLS)REBASEALWAYS(pwnd, pcls); if (index == GCW_ATOM) { return (WORD)_GetClassData(pclsClient, pwnd, index, FALSE); } else { if ((index < 0) || (index + (int)sizeof(WORD) > pclsClient->cbclsExtra)) { RIPERR0(ERROR_INVALID_INDEX, RIP_VERBOSE, ""); return 0; } else { WORD UNALIGNED *puw; puw = (WORD UNALIGNED *)((BYTE *)(pclsClient + 1) + index); return *puw; } } }
/* * @implemented */ INT WINAPI DECLSPEC_HOTPATCH GetScrollPos(HWND Wnd, INT Bar) { PWND pwnd; PSBDATA pSBData; TRACE("Wnd=%p Bar=%d\n", Wnd, Bar); /* Refer SB_CTL requests to the window */ if (SB_CTL == Bar) { return SendMessageW(Wnd, SBM_GETPOS, (WPARAM) 0, (LPARAM) 0); } else if (Bar == SB_HORZ || Bar == SB_VERT ) { pwnd = ValidateHwnd(Wnd); if (!pwnd) return 0; if (pwnd->pSBInfo) { pSBData = IntGetSBData(pwnd, Bar); return pSBData->pos; } SetLastError(ERROR_NO_SCROLLBARS); TRACE("GetScrollPos No Scroll Info\n"); return 0; } SetLastError(ERROR_INVALID_PARAMETER); return 0; }
int DlgDirListComboBoxW( HWND hwndDlg, LPWSTR lpszPathSpecClient, int idComboBox, int idStaticPath, UINT attrib) { LPWSTR lpszPathSpec; PWND pwndDlg; TL tlpwndDlg; BOOL fRet; pwndDlg = ValidateHwnd(hwndDlg); if (pwndDlg == NULL) return FALSE; lpszPathSpec = lpszPathSpecClient; ThreadLock(pwndDlg, &tlpwndDlg); fRet = xxxDlgDirListHelper(pwndDlg, lpszPathSpec, (LPBYTE)lpszPathSpecClient, idComboBox, idStaticPath, attrib, FALSE); ThreadUnlock(&tlpwndDlg); return fRet; }
/* * @implemented */ int WINAPI GetUpdateRgn( HWND hWnd, HRGN hRgn, BOOL bErase) { PWND pWnd; if (!hRgn) { SetLastError(ERROR_INVALID_HANDLE); return ERROR; } pWnd = ValidateHwnd(hWnd); if (!pWnd) return ERROR; if ( pWnd->hrgnUpdate || pWnd->state & (WNDS_SENDERASEBACKGROUND|WNDS_SENDNCPAINT|WNDS_UPDATEDIRTY|WNDS_PAINTNOTPROCESSED)) { return NtUserGetUpdateRgn(hWnd, hRgn, bErase); } SetRectRgn(hRgn, 0, 0, 0, 0); return NULLREGION; }
HMONITOR MonitorFromWindow( IN HWND hwnd, IN DWORD dwFlags) { PMONITOR pMonitor; PWND pwnd; if (dwFlags > MONITOR_DEFAULTTONEAREST) { RIPERR1(ERROR_INVALID_FLAGS, RIP_WARNING, "Invalid flags to MonitorFromWindow, %x", dwFlags); return NULL; } if (hwnd) { pwnd = ValidateHwnd(hwnd); if (!pwnd) { return NULL; } } else { pwnd = NULL; } pMonitor = _MonitorFromWindow(pwnd, dwFlags); try { return PtoH(pMonitor); } except(W32ExceptionHandler(TRUE, RIP_WARNING)) { return NULL; } }
/* * @implemented */ BOOL WINAPI GetClientRect(HWND hWnd, LPRECT lpRect) { PWND Wnd = ValidateHwnd(hWnd); if (!Wnd) return FALSE; if (Wnd->style & WS_MINIMIZED) { lpRect->left = lpRect->top = 0; lpRect->right = GetSystemMetrics(SM_CXMINIMIZED); lpRect->bottom = GetSystemMetrics(SM_CYMINIMIZED); return TRUE; } if ( hWnd != GetDesktopWindow()) // Wnd->fnid != FNID_DESKTOP ) { /* lpRect->left = lpRect->top = 0; lpRect->right = Wnd->rcClient.right - Wnd->rcClient.left; lpRect->bottom = Wnd->rcClient.bottom - Wnd->rcClient.top; */ *lpRect = Wnd->rcClient; OffsetRect(lpRect, -Wnd->rcClient.left, -Wnd->rcClient.top); } else { lpRect->left = lpRect->top = 0; lpRect->right = Wnd->rcClient.right; lpRect->bottom = Wnd->rcClient.bottom; /* Do this until Init bug is fixed. This sets 640x480, see InitMetrics. lpRect->right = GetSystemMetrics(SM_CXSCREEN); lpRect->bottom = GetSystemMetrics(SM_CYSCREEN); */ } return TRUE; }
BOOL WINAPI RealGetScrollInfo(HWND Wnd, INT SBType, LPSCROLLINFO Info) { PWND pWnd; PSBDATA pSBData; if (SB_CTL == SBType) { return SendMessageW(Wnd, SBM_GETSCROLLINFO, 0, (LPARAM) Info); } pWnd = ValidateHwnd(Wnd); if (!pWnd) return FALSE; if (SBType < SB_HORZ || SBType > SB_VERT) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } if (!pWnd->pSBInfo) { SetLastError(ERROR_NO_SCROLLBARS); return FALSE; } pSBData = IntGetSBData(pWnd, SBType); return NtUserSBGetParms(Wnd, SBType, pSBData, Info); }
/* * @implemented */ BOOL WINAPI GetUpdateRect( HWND Wnd, LPRECT Rect, BOOL Erase) { PWND pWnd; pWnd = ValidateHwnd(Wnd); if (!pWnd) return FALSE; if ( pWnd->hrgnUpdate || pWnd->state & (WNDS_SENDERASEBACKGROUND|WNDS_SENDNCPAINT|WNDS_UPDATEDIRTY|WNDS_PAINTNOTPROCESSED)) { return NtUserGetUpdateRect(Wnd, Rect, Erase); } if (Rect) { // Did the Rgn update? No! Back set and shutup! Rect->left = Rect->right = Rect->top = Rect->bottom = 0; } return FALSE; // msdn: "If there is no update region, the return value is zero." }
/* * @implemented */ int WINAPI GetWindowRgnBox( HWND hWnd, LPRECT lprc) { PWND pWnd; int Ret; if (!lprc) return ERROR; pWnd = ValidateHwnd(hWnd); if (!pWnd || !pWnd->hrgnClip || pWnd->state2 & WNDS2_MAXIMIZEDMONITORREGION) return ERROR; Ret = GetRgnBox(pWnd->hrgnClip, lprc); if (!Ret) return ERROR; /* if (hWnd != GetDesktopWindow()) // pWnd->fnid != FNID_DESKTOP) OffsetRect(lprc, -pWnd->rcWindow.left, -pWnd->rcWindow.top); */ if (pWnd->ExStyle & WS_EX_LAYOUTRTL) MirrorWindowRect(pWnd, lprc); return Ret; }
/* * @implemented */ int WINAPI GetWindowRgn( HWND hWnd, HRGN hRgn) { PWND pWnd; int Ret; if (!hRgn) return ERROR; pWnd = ValidateHwnd(hWnd); if (!pWnd || !pWnd->hrgnClip || pWnd->state2 & WNDS2_MAXIMIZEDMONITORREGION) return ERROR; Ret = CombineRgn(hRgn, pWnd->hrgnClip, NULL, RGN_COPY); if (!Ret) return ERROR; /* if (hWnd != GetDesktopWindow()) // pWnd->fnid != FNID_DESKTOP) Ret = OffsetRgn(hRgn, -pWnd->rcWindow.left, -pWnd->rcWindow.top); */ if (pWnd->ExStyle & WS_EX_LAYOUTRTL) MirrorRgn(hWnd, hRgn); return Ret; }
// // Switch System Class Window Proc. // LRESULT WINAPI SwitchWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode ) { PWND pWnd; PALTTABINFO ati; pWnd = ValidateHwnd(hWnd); if (pWnd) { if (!pWnd->fnid) { NtUserSetWindowFNID(hWnd, FNID_SWITCH); } } switch (uMsg) { case WM_NCCREATE: if (!(ati = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ati)))) return 0; SetWindowLongPtrW( hWnd, 0, (LONG_PTR)ati ); return TRUE; case WM_SHOWWINDOW: if (wParam == TRUE) { PrepareWindow(); ati = (PALTTABINFO)GetWindowLongPtrW(hWnd, 0); ati->cItems = nItems; ati->cxItem = ati->cyItem = 43; ati->cRows = nRows; ati->cColumns = nCols; } return 0; case WM_MOUSEMOVE: ProcessMouseMessage(uMsg, lParam); return 0; case WM_ACTIVATE: if (wParam == WA_INACTIVE) { CompleteSwitch(FALSE); } return 0; case WM_PAINT: OnPaint(hWnd); return 0; case WM_DESTROY: isOpen = FALSE; ati = (PALTTABINFO)GetWindowLongPtrW(hWnd, 0); HeapFree( GetProcessHeap(), 0, ati ); SetWindowLongPtrW( hWnd, 0, 0 ); DestroyAppWindows(); NtUserSetWindowFNID(hWnd, FNID_DESTROY); return 0; } return DefWindowProcW(hWnd, uMsg, wParam, lParam); }
/* * @implemented */ BOOL WINAPI GetScrollBarInfo( _In_ HWND hwnd, _In_ LONG idObject, _Inout_ LPSCROLLBARINFO info) { BOOL Ret; PWND pWnd = ValidateHwnd(hwnd); TRACE("hwnd=%p idObject=%d info=%p\n", hwnd, idObject, info); if (!pWnd) return FALSE; Ret = NtUserGetScrollBarInfo(hwnd, idObject, info); // This will be fixed once SB is server side. /* rcScrollBar needs to be in screen coordinates */ OffsetRect( &(info->rcScrollBar), pWnd->rcWindow.left, pWnd->rcWindow.top ); return Ret; }
LRESULT WINAPI ImeWndProc_common( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode ) // ReactOS { PWND pWnd; PIMEUI pimeui; pWnd = ValidateHwnd(hwnd); if (pWnd) { if (!pWnd->fnid) { if (msg != WM_NCCREATE) { if (unicode) return DefWindowProcW(hwnd, msg, wParam, lParam); return DefWindowProcA(hwnd, msg, wParam, lParam); } NtUserSetWindowFNID(hwnd, FNID_IME); pimeui = HeapAlloc( GetProcessHeap(), 0, sizeof(IMEUI) ); SetWindowLongPtrW(hwnd, 0, (LONG_PTR)pimeui); } else { if (pWnd->fnid != FNID_IME) { ERR("Wrong window class for Ime! fnId 0x%x\n",pWnd->fnid); return 0; } pimeui = ((PIMEWND)pWnd)->pimeui; if (pimeui == NULL) { ERR("Window is not set to IME!\n"); return 0; } } } if (msg==WM_CREATE || msg==WM_NCCREATE) return TRUE; if (msg==WM_NCDESTROY) { HeapFree( GetProcessHeap(), 0, pimeui ); SetWindowLongPtrW(hwnd, 0, 0); NtUserSetWindowFNID(hwnd, FNID_DESTROY); } if (unicode) return DefWindowProcW(hwnd, msg, wParam, lParam); return DefWindowProcA(hwnd, msg, wParam, lParam); }
/*********************************************************************** * ScrollTrackScrollBar * * Track a mouse button press on a scroll-bar. * pt is in screen-coordinates for non-client scroll bars. */ VOID FASTCALL ScrollTrackScrollBar(HWND Wnd, INT SBType, POINT Pt) { MSG Msg; UINT XOffset = 0, YOffset = 0; if (SBType != SB_CTL) { // Used with CMD mouse tracking. PWND pwnd = ValidateHwnd(Wnd); if (!pwnd) return; XOffset = pwnd->rcClient.left - pwnd->rcWindow.left; YOffset = pwnd->rcClient.top - pwnd->rcWindow.top; // RECT rect; // WIN_GetRectangles( Wnd, COORDS_CLIENT, &rect, NULL ); ScreenToClient(Wnd, &Pt); // Pt.x -= rect.left; // Pt.y -= rect.top; Pt.x += XOffset; Pt.y += YOffset; } IntScrollHandleScrollEvent(Wnd, SBType, WM_LBUTTONDOWN, Pt); do { if (!GetMessageW(&Msg, 0, 0, 0)) break; if (CallMsgFilterW(&Msg, MSGF_SCROLLBAR)) continue; if ( Msg.message == WM_LBUTTONUP || Msg.message == WM_MOUSEMOVE || (Msg.message == WM_SYSTIMER && Msg.wParam == SCROLL_TIMER)) { Pt.x = LOWORD(Msg.lParam) + XOffset; Pt.y = HIWORD(Msg.lParam) + YOffset; IntScrollHandleScrollEvent(Wnd, SBType, Msg.message, Pt); } else { TranslateMessage(&Msg); DispatchMessageW(&Msg); } if (!IsWindow(Wnd)) { ReleaseCapture(); break; } } while (Msg.message != WM_LBUTTONUP && GetCapture() == Wnd); }
/* * @implemented */ BOOL WINAPI UpdateWindow( HWND hWnd) { PWND pWnd = ValidateHwnd(hWnd); if (!pWnd) return FALSE; if ( pWnd->hrgnUpdate || pWnd->state & WNDS_INTERNALPAINT || pWnd->spwndChild ) { return NtUserxUpdateWindow(hWnd); } return TRUE; }
/* * @implemented */ BOOL WINAPI ClientToScreen(HWND hWnd, LPPOINT lpPoint) { PWND Wnd; /* Note: Desktop Top and Left is always 0! */ Wnd = ValidateHwnd(hWnd); if (!Wnd) return FALSE; if ( hWnd != GetDesktopWindow()) // Wnd->fnid != FNID_DESKTOP ) { if (Wnd->ExStyle & WS_EX_LAYOUTRTL) lpPoint->x = Wnd->rcClient.right - lpPoint->x; else lpPoint->x += Wnd->rcClient.left; lpPoint->y += Wnd->rcClient.top; } return TRUE; }
int DlgDirListComboBoxA( HWND hwndDlg, LPSTR lpszPathSpecClient, int idComboBox, int idStaticPath, UINT attrib) { LPWSTR lpszPathSpec; TL tlpwndDlg; PWND pwndDlg; BOOL fRet; pwndDlg = ValidateHwnd(hwndDlg); if (pwndDlg == NULL) return FALSE; lpszPathSpec = NULL; if (lpszPathSpecClient) { if (!MBToWCS(lpszPathSpecClient, -1, &lpszPathSpec, -1, TRUE)) return FALSE; } ThreadLock(pwndDlg, &tlpwndDlg); fRet = xxxDlgDirListHelper(pwndDlg, lpszPathSpec, lpszPathSpecClient, idComboBox, idStaticPath, attrib, FALSE); ThreadUnlock(&tlpwndDlg); if (lpszPathSpec) { if (fRet) { /* * Non-zero retval means some text to copy out. Copy out up to * the nul terminator (buffer will be big enough). */ WCSToMB(lpszPathSpec, -1, &lpszPathSpecClient, MAXLONG, FALSE); } UserLocalFree(lpszPathSpec); } return fRet; }
LRESULT WINAPI ComboListBoxWndProcW( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { PWND pwnd; if ((pwnd = ValidateHwnd(hwnd)) == NULL) { return (0L); } /* * If the control is not interested in this message, * pass it to DefWindowProc. */ if (!FWINDOWMSG(message, FNID_LISTBOX)) return DefWindowProcWorker(pwnd, message, wParam, lParam, FALSE); return ListBoxWndProcWorker(pwnd, message, wParam, lParam, FALSE); }
/*********************************************************************** * IntScrollGetThumbVal * * Compute the current scroll position based on the thumb position in pixels * from the top of the scroll-bar. */ static UINT FASTCALL IntScrollGetThumbVal(HWND Wnd, INT SBType, PSCROLLBARINFO ScrollBarInfo, BOOL Vertical, INT Pos) { PWND pWnd; PSBDATA pSBData; INT Pixels = Vertical ? ScrollBarInfo->rcScrollBar.bottom - ScrollBarInfo->rcScrollBar.top : ScrollBarInfo->rcScrollBar.right - ScrollBarInfo->rcScrollBar.left; pWnd = ValidateHwnd( Wnd ); if (!pWnd) return FALSE; pSBData = IntGetSBData(pWnd, SBType); if ((Pixels -= 2 * ScrollBarInfo->dxyLineButton) <= 0) { return pSBData->posMin; } if ((Pixels -= (ScrollBarInfo->xyThumbBottom - ScrollBarInfo->xyThumbTop)) <= 0) { return pSBData->posMin; } Pos = Pos - ScrollBarInfo->dxyLineButton; if (Pos < 0) { Pos = 0; } if (Pos > Pixels) Pos = Pixels; if (!pSBData->page) Pos *= pSBData->posMax - pSBData->posMin; else Pos *= pSBData->posMax - pSBData->posMin - pSBData->page + 1; return pSBData->posMin + ((Pos + Pixels / 2) / Pixels); }
/* * @implemented */ HWND WINAPI GetAncestor(HWND hwnd, UINT gaFlags) { HWND Ret = NULL; PWND Ancestor, Wnd; Wnd = ValidateHwnd(hwnd); if (!Wnd) return NULL; _SEH2_TRY { Ancestor = NULL; switch (gaFlags) { case GA_PARENT: if (Wnd->spwndParent != NULL) Ancestor = DesktopPtrToUser(Wnd->spwndParent); break; default: /* FIXME: Call win32k for now */ Wnd = NULL; break; } if (Ancestor != NULL) Ret = UserHMGetHandle(Ancestor); } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { /* Do nothing */ } _SEH2_END; if (!Wnd) /* Fall back */ Ret = NtUserGetAncestor(hwnd, gaFlags); return Ret; }
LRESULT WINAPI MsgWindowProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ) { PWND pWnd; pWnd = ValidateHwnd(hwnd); if (pWnd) { if (!pWnd->fnid) { NtUserSetWindowFNID(hwnd, FNID_MESSAGEWND); } } if (message == WM_NCCREATE) return TRUE; if (message == WM_DESTROY) NtUserSetWindowFNID(hwnd, FNID_DESTROY); return DefWindowProc(hwnd, message, wParam, lParam ); }
/* * @implemented */ HWND WINAPI GetLastActivePopup(HWND hWnd) { PWND Wnd; HWND Ret = hWnd; Wnd = ValidateHwnd(hWnd); if (Wnd != NULL) { _SEH2_TRY { if (Wnd->spwndLastActive) { PWND LastActive = DesktopPtrToUser(Wnd->spwndLastActive); Ret = UserHMGetHandle(LastActive); } } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { /* Do nothing */ } _SEH2_END; }
/* * @implemented */ BOOL WINAPI DECLSPEC_HOTPATCH GetScrollRange(HWND Wnd, int Bar, LPINT MinPos, LPINT MaxPos) { PWND pwnd; PSBDATA pSBData; TRACE("Wnd=%x Bar=%d Min=%p Max=%p\n", Wnd, Bar, MinPos, MaxPos); /* Refer SB_CTL requests to the window */ if (SB_CTL == Bar) { return SendMessageW(Wnd, SBM_GETRANGE, (WPARAM) MinPos, (LPARAM) MaxPos); } else if (Bar == SB_HORZ || Bar == SB_VERT ) { pwnd = ValidateHwnd(Wnd); if (!pwnd) return FALSE; if (pwnd->pSBInfo) { pSBData = IntGetSBData(pwnd, Bar); *MinPos = pSBData->posMin; *MaxPos = pSBData->posMax; } else { SetLastError(ERROR_NO_SCROLLBARS); *MinPos = 0; *MaxPos = 0; } return TRUE; } SetLastError(ERROR_INVALID_PARAMETER); return FALSE; }
int DlgDirSelectComboBoxExW( HWND hwndDlg, LPWSTR pwszOut, int cchOut, int idComboBox) { BOOL fRet; TL tlpwndComboBox; TL tlpwndList; PWND pwndDlg; PWND pwndComboBox; PCBOX pcbox; pwndDlg = ValidateHwnd(hwndDlg); if (pwndDlg == NULL) return FALSE; pwndComboBox = _GetDlgItem(pwndDlg, idComboBox); if (pwndComboBox == NULL) { RIPERR0(ERROR_CONTROL_ID_NOT_FOUND, RIP_VERBOSE, ""); return 0; } pcbox = ((PCOMBOWND)pwndComboBox)->pcbox; if (pcbox == NULL) { RIPERR0(ERROR_WINDOW_NOT_COMBOBOX, RIP_VERBOSE, ""); return 0; } ThreadLockAlways(pwndComboBox, &tlpwndComboBox); ThreadLock(pcbox->spwndList, &tlpwndList); fRet = xxxDlgDirSelectHelper(pwndComboBox, pwszOut, cchOut, pcbox->spwndList); ThreadUnlock(&tlpwndList); ThreadUnlock(&tlpwndComboBox); return fRet; }
BOOL SetScrollRange( HWND hwnd, int code, int posMin, int posMax, BOOL fRedraw) { SCROLLINFO si; /* * Validate the window handle first, because the further call * to NtUserSetScrollInfo will return the position of the scrollbar * and not FALSE if the hwnd is invalid */ if ( ValidateHwnd((hwnd)) == NULL) return FALSE; /* * Check if the 'Range'(Max - Min) can be represented by an integer; * If not, it is an error; * Fix for Bug #1089 -- SANKAR -- 20th Sep, 1989 --. */ if ((unsigned int)(posMax - posMin) > MAXLONG) { RIPERR0(ERROR_INVALID_SCROLLBAR_RANGE, RIP_VERBOSE, ""); return FALSE; } si.fMask = SIF_RANGE; si.nMin = posMin; si.nMax = posMax; si.cbSize = sizeof(SCROLLINFO); NtUserSetScrollInfo(hwnd, code, &si, fRedraw); return TRUE; }
/* * @implemented */ BOOL WINAPI DECLSPEC_HOTPATCH SetScrollRange(HWND hWnd, INT nBar, INT nMinPos, INT nMaxPos, BOOL bRedraw) { PWND pWnd; SCROLLINFO ScrollInfo; pWnd = ValidateHwnd(hWnd); if ( !pWnd ) return FALSE; if ((nMaxPos - nMinPos) > MAXLONG) { SetLastError(ERROR_INVALID_SCROLLBAR_RANGE); return FALSE; } ScrollInfo.cbSize = sizeof(SCROLLINFO); ScrollInfo.fMask = SIF_RANGE; ScrollInfo.nMin = nMinPos; ScrollInfo.nMax = nMaxPos; SetScrollInfo(hWnd, nBar, &ScrollInfo, bRedraw); // do not bypass themes. return TRUE; }