(1) Controls
The npage and NPOs in the scrollinfo structure have a range limit. Windows will automatically correct the limit when the range is exceeded.
0 <= npage <= Nmax-Nmin + 1
0 <= NPOs <= Nmax-(nPage-1)
So don't always think that you have set the page size and the position of the scroll bar. The page and position of the scroll bar will certainly be as you have set.
When using edit_setsel, you must set the focus on edit. Otherwise, the selected effect is not displayed.
(2) programming skills
It is very good to use the window subclass to change some common behaviors of the control. For example, when you click a button with the mouse, select all the edit boxes and do not add them to the corresponding button message in wm_command. Can you give it a try? The key lies in the mouse clicking. When the left mouse button is released, the wm_command message is sent first, and then wm_setfocus is sent to the button. to select all the edit boxes, the edit box must be focused, however, it is only temporary for wm_command to focus on the editing box, and then the wm_lbuttonup of the button itself sets the focus on itself, so the getting focus of the editing box is only an instant. To solve this problem, we use the window subclass for buttons. Call callwindowproc in wm_lbuttonup, and then transfer the focus to the edit box.