user-0 提问: 滚动条的SB_TOP和SB_BOTTOM好像没有用？收不到？

回复:
user: user-1
content: 标准滚动条的滑块的大小一般根据窗口大小和所要显示的内容大小成比例显示（如果内容大小不变的话，窗口越小滑块越小），当然，如果内容实在太大，按比例的话滑块几乎为零，此时系统还是会显示滑块的，就不按比例显示  case WM_SIZE:       cxClient = LOWORD(lParam);       cyClient = HIWORD(lParam);        //设定垂直滚动条范围和页面大小       si.cbSize = sizeof(si);       si.fMask  = SIF_RANGE | SIF_PAGE;       si.nMin   = 0;       si.nMax   = cyBitmap - 1;       si.nPage  = cyClient;       SetScrollInfo(hwnd, SB_VERT, &si, TRUE);        //设定水平滚动条范围和页面大小       /*       si.cbSize = sizeof(si);       si.fMask  = SIF_RANGE | SIF_PAGE;       si.nMin   = 0;       //*/       si.nMax   = cxBitmap - 1;       si.nPage	 = cxClient;       SetScrollInfo(hwnd, SB_HORZ, &si, TRUE);       return 0;

user: user-0
content: 引用 3 楼 Intel0011 的回复:滚动条的SB_TOP和SB_BOTTOM的这两个消息需要Shift键的配合才有效 SB_TOP:	      //置顶(先按下Shift键不放,然后点击滚动条方块上侧区域就能置顶) SB_BOTTOM: //置顶(先按下Shift键不放,然后点击滚动条方块下侧区域就能置底) 话说标准滚动条的滑块的大小可以修改吗？

user: user-1
content: 引用 7 楼 六道佩恩 的回复:也就是说，标准滚动条在用户操作的情况下是不产生SB_TOP和SB_BOTTOM的是吧？ 是的,按文档上的说明应该是这样的

user: user-0
content: 引用 6 楼 Intel0011 的回复:貌似SB_TOP和SB_BOTTOM是滚动条控件类的属性，窗口自带的标准滚动条没有 如果需要的话，需要自己在WM_KEYDOWN中模拟 case WM_KEYDOWN: 		switch (wParam)       { 		case VK_HOME: 			SendMessage(hwnd, WM_VSCROLL, SB_TOP, 0); 			break; 		case VK_END: 			SendMessage(hwnd, WM_VSCROLL, SB_BOTTOM, 0); 			break; 	   case VK_PRIOR: 			SendMessage(hwnd, WM_VSCROLL, SB_PAGEUP, 0); 			break; 		case VK_NEXT: 			SendMessage(hwnd, WM_VSCROLL, SB_PAGEDOWN, 0); 			break; 		case VK_UP: 			SendMessage(hwnd, WM_VSCROLL, SB_LINEUP, 0); 			break; 		case VK_DOWN: 			SendMessage(hwnd, WM_VSCROLL, SB_LINEDOWN, 0); 			break;       case VK_LEFT: 			SendMessage(hwnd, WM_HSCROLL, SB_LINELEFT, 0); 			break; 		case VK_RIGHT: 			SendMessage(hwnd, WM_HSCROLL, SB_LINERIGHT, 0); 			break; 	   case VK_BROWSER_BACK: 	      SendMessage(hwnd, WM_HSCROLL, SB_PAGELEFT, 0); 			break; 	   case VK_BROWSER_FORWARD: 	      SendMessage(hwnd, WM_HSCROLL, SB_PAGERIGHT, 0); 			break; 		} 	   return 0;  https://docs.microsoft.com/zh-cn/windows/win32/controls/about-scroll-bars  A scroll bar is included in a window either as a standard scroll bar or as a scroll bar control.  A standard scroll bar is located in the nonclient area of a window. It is created with the window and displayed when the window is displayed.  A scroll bar control is a control window that belongs to the SCROLLBAR window class. A scroll bar control appears and functions like a standard scroll bar, but it is a separate window.   A scroll bar control provides a built-in keyboard interface that enables the user to issue scrolling requests by using the keyboard; a standard scroll bar does not. When a scroll bar control has the keyboard focus, it sends WM_HSCROLL and WM_VSCROLL messages to its parent window when the user presses the arrow keys. The request code is sent with each message corresponding to the arrow key the user has pressed. Following are the arrow keys and their corresponding request codes.  Arrow key   Request code DOWN       SB_LINEDOWN or SB_LINERIGHT  END           SB_BOTTOM  HOME       SB_TOP  LEFT          SB_LINEUP or SB_LINELEFT  PGDN       SB_PAGEDOWN or SB_PAGERIGHT  PGUP        SB_PAGEUP or SB_PAGELEFT  RIGHT      SB_LINEDOWN or SB_LINERIGHT  UP           SB_LINEUP or SB_LINELEFT   If you want a keyboard interface for a standard scroll bar, you can create one yourself by processing the WM_KEYDOWN message in your window procedure and then performing the appropriate scrolling action based on the virtual-key code that accompanies the message.  也就是说，标准滚动条在用户操作的情况下是不产生SB_TOP和SB_BOTTOM的是吧？

user: user-1
content: 貌似SB_TOP和SB_BOTTOM是滚动条控件类的属性，窗口自带的标准滚动条没有 如果需要的话，需要自己在WM_KEYDOWN中模拟 case WM_KEYDOWN: 		switch (wParam)       { 		case VK_HOME: 			SendMessage(hwnd, WM_VSCROLL, SB_TOP, 0); 			break; 		case VK_END: 			SendMessage(hwnd, WM_VSCROLL, SB_BOTTOM, 0); 			break; 	   case VK_PRIOR: 			SendMessage(hwnd, WM_VSCROLL, SB_PAGEUP, 0); 			break; 		case VK_NEXT: 			SendMessage(hwnd, WM_VSCROLL, SB_PAGEDOWN, 0); 			break; 		case VK_UP: 			SendMessage(hwnd, WM_VSCROLL, SB_LINEUP, 0); 			break; 		case VK_DOWN: 			SendMessage(hwnd, WM_VSCROLL, SB_LINEDOWN, 0); 			break;       case VK_LEFT: 			SendMessage(hwnd, WM_HSCROLL, SB_LINELEFT, 0); 			break; 		case VK_RIGHT: 			SendMessage(hwnd, WM_HSCROLL, SB_LINERIGHT, 0); 			break; 	   case VK_BROWSER_BACK: 	      SendMessage(hwnd, WM_HSCROLL, SB_PAGELEFT, 0); 			break; 	   case VK_BROWSER_FORWARD: 	      SendMessage(hwnd, WM_HSCROLL, SB_PAGERIGHT, 0); 			break; 		} 	   return 0;  https://docs.microsoft.com/zh-cn/windows/win32/controls/about-scroll-bars  A scroll bar is included in a window either as a standard scroll bar or as a scroll bar control.  A standard scroll bar is located in the nonclient area of a window. It is created with the window and displayed when the window is displayed.  A scroll bar control is a control window that belongs to the SCROLLBAR window class. A scroll bar control appears and functions like a standard scroll bar, but it is a separate window.   A scroll bar control provides a built-in keyboard interface that enables the user to issue scrolling requests by using the keyboard; a standard scroll bar does not. When a scroll bar control has the keyboard focus, it sends WM_HSCROLL and WM_VSCROLL messages to its parent window when the user presses the arrow keys. The request code is sent with each message corresponding to the arrow key the user has pressed. Following are the arrow keys and their corresponding request codes.  Arrow key   Request code DOWN       SB_LINEDOWN or SB_LINERIGHT  END           SB_BOTTOM  HOME       SB_TOP  LEFT          SB_LINEUP or SB_LINELEFT  PGDN       SB_PAGEDOWN or SB_PAGERIGHT  PGUP        SB_PAGEUP or SB_PAGELEFT  RIGHT      SB_LINEDOWN or SB_LINERIGHT  UP           SB_LINEUP or SB_LINELEFT   If you want a keyboard interface for a standard scroll bar, you can create one yourself by processing the WM_KEYDOWN message in your window procedure and then performing the appropriate scrolling action based on the virtual-key code that accompanies the message.

user: user-2
content: 可能是它看到“SB”两个字母，不想理睬你了。

user: user-0
content: 引用 3 楼 Intel0011 的回复:滚动条的SB_TOP和SB_BOTTOM的这两个消息需要Shift键的配合才有效 SB_TOP:	      //置顶(先按下Shift键不放,然后点击滚动条方块上侧区域就能置顶) SB_BOTTOM: //置顶(先按下Shift键不放,然后点击滚动条方块下侧区域就能置底) 没有，按住Shift再按的效果是立刻到达该位置，，不是到底或到顶

user: user-1
content: 滚动条的SB_TOP和SB_BOTTOM的这两个消息需要Shift键的配合才有效 SB_TOP:	      //置顶(先按下Shift键不放,然后点击滚动条方块上侧区域就能置顶) SB_BOTTOM: //置顶(先按下Shift键不放,然后点击滚动条方块下侧区域就能置底)

user: user-0
content: 引用 1 楼 飞雪蝶映 的回复:应该是应用错了吧。你得贴你的应用代码。 wParam == SB_TOP  		case WM_VSCROLL: 			switch( LOWORD(wParam) ) 			{ 				case SB_TOP:			printf("1\n"); 	break; 				case SB_BOTTOM:			printf("2\n"); 	break; 				case SB_LINEUP:			printf("3\n");	break; 				case SB_LINEDOWN:		printf("4\n");	break; 				case SB_PAGEUP:			printf("5\n");	break; 				case SB_PAGEDOWN:		printf("6\n");	break; 				case SB_THUMBPOSITION:	printf("7\n");	break; 				case SB_THUMBTRACK: 	printf("8\n");	break; 			} 			return 0;

user: user-3
content: 应该是应用错了吧。你得贴你的应用代码。 wParam == SB_TOP