Closed yanpeng closed 1 year ago
I'll check the sample and the book's notes to see if it's an oversight. If it is, I'll update this issue and either fix the problem or add a comment to the sample.
It's a bit confusing but this doesn't appear to be a bug or oversight. SB_PAGEUP
and SB_PAGELEFT
share the same ordinal value of 2, and SB_PAGEDOWN
and SB_PAGERIGHT
share the same ordinal value of 3. I've reproduced the relevant #defines
from winuser.h
below for reference.
/*
* Scroll Bar Commands
*/
#define SB_LINEUP 0
#define SB_LINELEFT 0
#define SB_LINEDOWN 1
#define SB_LINERIGHT 1
#define SB_PAGEUP 2
#define SB_PAGELEFT 2
#define SB_PAGEDOWN 3
#define SB_PAGERIGHT 3
#define SB_THUMBPOSITION 4
#define SB_THUMBTRACK 5
#define SB_TOP 6
#define SB_LEFT 6
#define SB_BOTTOM 7
#define SB_RIGHT 7
So sending SB_PAGEUP
or SB_PAGEDOWN
will still get handled as part of the SB_PAGELEFT
and SB_PAGERIGHT
sections in the WM_HSCROLL
message (lines 183 and 187 respectively), and the effect will be to scroll the window left or right (assuming the window is narrow enough for the horizontal scroll bar to appear). I confirmed this by stepping through the code in the debugger.
So like I said, it's a bit confusing, but it appears to be intentional. Since nothing appears to be amiss, I'll close this issue.
Thanks, Vasilios
In the line 246
and in the line 250
in the
LOWORD(wParam)
ofWM_HSCROLL
, there are no correspondingSB_PAGEUP
andSB_PAGEDOWN
, I think the author made some errors by accident.