| 424 | } |
| 425 | |
| 426 | void |
| 427 | onMSNH_VScroll(HWND hWnd, WPARAM wParam, LPARAM lParam) |
| 428 | { |
| 429 | PNHMessageWindow data; |
| 430 | SCROLLINFO si; |
| 431 | int yInc; |
| 432 | |
| 433 | UNREFERENCED_PARAMETER(lParam); |
| 434 | |
| 435 | /* get window data */ |
| 436 | data = (PNHMessageWindow) GetWindowLongPtr(hWnd, GWLP_USERDATA); |
| 437 | |
| 438 | ZeroMemory(&si, sizeof(si)); |
| 439 | si.cbSize = sizeof(si); |
| 440 | si.fMask = SIF_PAGE | SIF_POS; |
| 441 | GetScrollInfo(hWnd, SB_VERT, &si); |
| 442 | |
| 443 | switch (LOWORD(wParam)) { |
| 444 | // User clicked the shaft above the scroll box. |
| 445 | |
| 446 | case SB_PAGEUP: |
| 447 | yInc = -(int) si.nPage; |
| 448 | break; |
| 449 | |
| 450 | // User clicked the shaft below the scroll box. |
| 451 | |
| 452 | case SB_PAGEDOWN: |
| 453 | yInc = si.nPage; |
| 454 | break; |
| 455 | |
| 456 | // User clicked the top arrow. |
| 457 | |
| 458 | case SB_LINEUP: |
| 459 | yInc = -1; |
| 460 | break; |
| 461 | |
| 462 | // User clicked the bottom arrow. |
| 463 | |
| 464 | case SB_LINEDOWN: |
| 465 | yInc = 1; |
| 466 | break; |
| 467 | |
| 468 | // User dragged the scroll box. |
| 469 | |
| 470 | case SB_THUMBTRACK: |
| 471 | yInc = HIWORD(wParam) - data->yPos; |
| 472 | break; |
| 473 | |
| 474 | default: |
| 475 | yInc = 0; |
| 476 | } |
| 477 | |
| 478 | // If applying the vertical scrolling increment does not |
| 479 | // take the scrolling position out of the scrolling range, |
| 480 | // increment the scrolling position, adjust the position |
| 481 | // of the scroll box, and update the window. UpdateWindow |
| 482 | // sends the WM_PAINT message. |
| 483 | |