home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c480 / 18.ddi / SAMPLES / MUSCROLL / MUSCROLL.TX_ / MUSCROLL.TX
Encoding:
Text File  |  1993-02-08  |  12.4 KB  |  365 lines

  1. Microscroll Custom Control SDK Sample
  2. Microsoft Windows 3.1
  3. (c)1990-1992 Microsoft Corporation, All Rights Reserved
  4.  
  5.  
  6.  
  7. Introduction:
  8. -------------
  9.  
  10. The MicroScroll Custom Control is an interface extension to Microsoft
  11. Windows.  The control is implemented in a DLL that includes interface
  12. functions for the Windows Software Development Kit Dialog Editor.
  13.  
  14. The MicroScroll is essentially a scrollbar without a thumb or thumbtrack,
  15. and is capable of being much smaller than a standard scrollbar.  This
  16. means that it can be placed next to an edit control to create a spin
  17. button, such as in Control Panel's Date/Time dialog.  It sends scroll
  18. messages to its associate window to indicate that it was clicked.
  19. Initially the associate window is the parent of the control.  The associate
  20. window can do whatever it desires with the messages, which is useful in
  21. implementing many other classes of controls.
  22.  
  23. The remaining sections in this file describe the programming interface
  24. to the Microscroll control:
  25.  
  26.     Definitions
  27.     Styles
  28.     Messages and Message API Functions
  29.     Notification Codes
  30.  
  31.  
  32.  
  33. Definitions:
  34. ------------
  35.  
  36.   Associate Window
  37.     The window that receives all messages sent from a MicroScroll
  38.     control.  This is, by default, the parent window of the control
  39.     but may be any other window.
  40.  
  41.  
  42.   Range:
  43.     The values that define the minimum and maximum values of
  44.     the position.  The range minimum defines the lowest value of
  45.     the position, and the range maximum defines the highest position.
  46.  
  47.     The current position must lie between these two values, and the
  48.     minimum is always less than or equal to the maximum. The range must
  49.     be within the maximum limits of 0 to 32767.
  50.  
  51.   Current Position:
  52.     A value within the range that is sent to the associate window
  53.     with WM_VSCROLL and WM_HSCROLL message.  It can be changed with
  54.     the MSM_SETCURPOS message or by clicking the arrows of the control.
  55.  
  56.     Clicking the left and up arrows decrements the current position,
  57.     and clicking the right and down arrows increment the current
  58.     position.  If the MSS_INVERTRANGE style is used, the left and
  59.     up arrows increment the current position and the right and
  60.     down arrows decrement the current position.
  61.  
  62.     The current position must exist in the range, and therefore must
  63.     be a value from 0 to 32767.
  64.  
  65.  
  66.  
  67.  
  68. Styles:
  69. -------
  70.  
  71.   MSS_VERTICAL:
  72.     Specifies a MicroScroll with an up arrow and a down arrow.
  73.     This is the default style if neither MSS_VERTICAL nor
  74.     MSS_HORIZONTAL are specified.  A MicroScroll of this style
  75.     will send WM_VSCROLL messages to the associate window.  The
  76.     scroll code SB_LINEUP is sent when the up arrow is pressed,
  77.     and the scroll code SB_LINEDOWN is sent when the down arrow
  78.     is pressed.
  79.  
  80.     This style cannot be used with MSS_HORIZONTAL.
  81.  
  82.  
  83.   MSS_HORIZONTAL:
  84.     Specifies a MicroScroll with a left arrow and a right arrow.
  85.     A MicroScroll created with this style will send WM_HSCROLL
  86.     messages to the associate window.  The scroll code SB_LINEUP
  87.     is sent when the left arrow is pressed, and the scroll code
  88.     SB_LINEDOWN is sent when the right arrow is pressed.
  89.  
  90.     This style cannot be used with MSS_VERTICAL.
  91.  
  92.  
  93.   MSS_NOPEGSCROLL:
  94.     Specifies a MicroScroll that will not send scroll messages
  95.     if the current scroll position is at the minimum or maximum
  96.     of the range and the user has clicked on an arrow that would
  97.     send the position outside of the range.
  98.  
  99.     When this style is specified, scroll messages are only sent
  100.     when the position of the MicroScroll changes in response to
  101.     a user action.  Without this style, the MicroScroll control will
  102.     send scroll messages repeatedly when the current position is
  103.     pegged at either the minimum or maximum.
  104.  
  105.  
  106.   MSS_TEXTHASRANGE:
  107.     Specifies that the text given for the MicroScroll control will
  108.     be parsed to set the initial range (minimum, maximum), and
  109.     current position of the control.
  110.  
  111.     The text must be in the format:
  112.         min,max,pos     Example:  1,99,50
  113.  
  114.     Where min is the initial minimum of the range, max is the
  115.     initial maximum of the range, and pos is the initial position
  116.     that must be with the range.  If the values are not valid for
  117.     a MicroScroll range, that is between 0 and 32767, then the
  118.     defaults 1, 9, and 5 are used for the minimum, maximum, and
  119.     position respectively.
  120.  
  121.  
  122.     The defaults will be used if there is any error in parsing
  123.     this text.  Whitespace is not allowed between the values and
  124.     commas.  If the position specified in the text is not in the
  125.     specified range, then it is set to the midpoint of the range.
  126.     No scrolling messages are sent to the associate window on this
  127.     change.
  128.  
  129.  
  130.   MSS_INVERTRANGE:
  131.     Specifies that the change in the current position on clicking
  132.     the up/left and down/right arrows is inverted.  Without this
  133.     style, up/left decrements the current position and down/right
  134.     increments it.  With MSS_INVERTRANGE, up/left increments the
  135.     current position and down/right decrements it.
  136.  
  137.  
  138.  
  139. Messages and Message API Functions:
  140. -----------------------------------
  141.  
  142. If the wParam or lParam message parameters are not mentioned then
  143. they are not used.  All Message API functions take a window handle
  144. to identify the control to be affected.
  145.  
  146.  
  147.  
  148.   MSM_HWNDASSOCIATESET
  149.   HWND FAR PASCAL MSHAssociateSet(HWND hWnd, HWND hWndAssociate);
  150.  
  151.     Changes the current associate window of the control.
  152.  
  153.     Parameters:     Message   Function        Definition
  154.                     wParam    hWndAssociate   New associate window handle.
  155.  
  156.  
  157.     Return Value:   Previous associate window handle; contained in
  158.                     low-order word if returned from SendMessage.
  159.  
  160.     Comments:       The control always sends a WM_COMMAND message with the
  161.                     MSN_ASSOCIATELOSS to the previous associate window and
  162.                     a MSN_ASSOCIATEGAIN to the new associate window.
  163.  
  164.  
  165.  
  166.   MSM_HWNDASSOCIATEGET
  167.   HWND FAR PASCAL MSHAssociateGet(HWND hWnd);
  168.  
  169.     Returns the current associate window of the control.
  170.  
  171.     Parameters:     None
  172.  
  173.     Return Value:   Current associate window handle; contained in
  174.                     low-order word if returned from SendMessage.
  175.  
  176.  
  177.  
  178.   MSM_DWRANGESET
  179.   DWORD FAR PASCAL MSDwRangeSet(HWND hWnd, WORD iMin, WORD iMax);
  180.  
  181.     Changes the current range of the control, moving the position
  182.     if the current position is outside of the new range.
  183.  
  184.     Parameters:     Message         Function    Definition
  185.                     LOWORD(lParam)  iMin        New minimum of the range.
  186.                     HIWORD(lParam)  iMax        New maximum of the range.
  187.  
  188.     Return Value:   Previous range:  minimum is in the low-order word,
  189.                     maximum in the high-order word.
  190.  
  191.     Comments:       The control always sends a WM_COMMAND message with the
  192.                     MSN_RANGECHANGE notification to the associate window.
  193.                     If the current position is outside the new range, the
  194.                     position is set to the middle of the range and the
  195.                     control sends a scroll message with SB_THUMBTRACK.
  196.  
  197.  
  198.  
  199.  
  200.   MSM_DWRANGEGET
  201.   DWORD FAR PASCAL MSDwRangeGet(HWND hWnd);
  202.  
  203.     Returns the current range of the control.
  204.  
  205.     Parameters:     None
  206.  
  207.     Return Value:   Current range:  minimum is in the low-order word,
  208.                     maximum in the high-order word.
  209.  
  210.  
  211.  
  212.   MSM_WCURRENTPOSSET
  213.   WORD FAR PASCAL MSWCurrentPosSet(HWND hWnd, WORD iPos);
  214.  
  215.     Changes the current position of the control if the new position
  216.     is within the current range.,
  217.  
  218.     Parameters:     Message     Function    Definition
  219.                     wParam      iPos        New position.
  220.  
  221.     Return Value:   Previous position; contained in low-order word if
  222.                     returned from SendMessage.  -1 is returned if the
  223.                     new position is not in the current range.
  224.  
  225.     Comments:       If the new position is in the current range, the
  226.                     control always sends a scroll message with the
  227.                     SB_THUMTRACK code notification to the associate window.
  228.  
  229.  
  230.  
  231.   MSM_WCURRENTPOSGET
  232.   WORD FAR PASCAL MSWCurrentPosGet(HWND hWnd);
  233.  
  234.     Returns the current position of the control.
  235.  
  236.     Parameters:     None
  237.  
  238.     Return Value:   Current position; contained in low-order word if
  239.                     returned from SendMessage.
  240.  
  241.  
  242.  
  243.   MSM_FNOPEGSCROLLSET
  244.   BOOL FAR PASCAL MSFNoPegScrollSet(HWND hWnd, BOOL fNoPegScroll);
  245.  
  246.     Changes the MSS_NOPEGSCROLL style bit in the control.
  247.  
  248.     Parameters:     Message   Function        Definition
  249.                     wParam    fNoPegScroll    TRUE to set the
  250.                                               MSS_NOPEGSCROLL style or
  251.                                               FALSE to clear it.
  252.  
  253.     Return Value:   Previous state of the MSS_NOPEGSCROLL style bit;
  254.                     contained in the low-order WORD if returned from
  255.                     SendMessage.
  256.  
  257.  
  258.   MSM_FNOPEGSCROLLGET
  259.   BOOL FAR PASCAL MSFNoPegScrollGet(HWND hWnd);
  260.  
  261.     Returns the current state of the the MSS_NOPEGSCROLL style bit in
  262.     the control.
  263.  
  264.     Parameters:     None
  265.  
  266.     Return Value:   Current state of the MSS_NOPEGSCROLL style bit;
  267.                     contained in low-order word if returned from
  268.                     SendMessage.
  269.  
  270.  
  271.  
  272.   MSM_FINVERTRANGESET
  273.   BOOL FAR PASCAL MSFInvertRangeSet(HWND hWnd, BOOL fInvertRange);
  274.  
  275.     Changes the MSS_INVERTRANGE style bit in the control.
  276.  
  277.     Parameters:     Message     Function        Definition
  278.                     wParam      fInvertRange    TRUE to set the
  279.                                                 MSS_INVERTRANGE style or
  280.                                                 FALSE to clear it.
  281.  
  282.     Return Value:   Previous state of the MSS_INVERTRANGE style bit;
  283.                     contained in the low-order WORD if returned from
  284.                     SendMessage.
  285.  
  286.  
  287.  
  288.   MSM_FINVERTRANGEGET
  289.   BOOL FAR PASCAL MSFInvertRangeGet(HWND hWnd);
  290.  
  291.     Returns the current state of the the MSS_INVERTRANGE style bit in
  292.     the control.
  293.  
  294.     Parameters:     None
  295.  
  296.     Return Value:   Current state of the MSS_INVERTRANGE style bit;
  297.                     contained in low-order word if returned from
  298.                     SendMessage.
  299.  
  300.  
  301.  
  302.   MSM_CRCOLORSET
  303.   COLORREF FAR PASCAL MSCrColorSet(HWND hWnd, WORD iColor, COLORREF cr);
  304.  
  305.     Changes a specified color used in the control.
  306.  
  307.     Parameters:     Message     Function    Definition
  308.                     wParam      iColor      Index of the color to change.
  309.                     lParam      cr          New COLORREF value for the color.
  310.  
  311.                     iColor can be one of the following:
  312.                         MSCOLOR_FACE        Face color
  313.                         MSCOLOR_ARROW       Arrow color
  314.                         MSCOLOR_SHADOW      Dark shadowing color
  315.                         MSCOLOR_HIGHLIGHT   Bright highlight color
  316.                         MSCOLOR_FRAME       Outer frame color
  317.  
  318.  
  319.  
  320.     Return Value:   Previous color for the given index.  0L if the color
  321.                     index is out of range.
  322.  
  323.  
  324.  
  325.   MSM_CRCOLORGET
  326.   COLORREF FAR PASCAL MSCrColorGet(HWND hWnd, WORD iColor);
  327.  
  328.     Returns a specified color used in the control.
  329.  
  330.     Parameters:     Message     Function    Definition
  331.                     wParam      iColor      Index of the color to change.
  332.  
  333.                     iColor can be one of the following:
  334.                         MSCOLOR_FACE        Face color
  335.                         MSCOLOR_ARROW       Arrow color
  336.                         MSCOLOR_SHADOW      Dark shadowing color
  337.                         MSCOLOR_HIGHLIGHT   Bright highlight color
  338.                         MSCOLOR_FRAME       Outer frame color
  339.  
  340.  
  341.  
  342.     Return Value:   Current color for the given index.  -1 if the
  343.                     control is using a default color.  0L if the color
  344.                     index is out of range.
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351. Notification Codes:
  352. -------------------
  353.  
  354.   MSN_ASSOCIATELOSS:
  355.     Notifies the current associate window of a Microscroll that it
  356.     is no longer the associate.
  357.  
  358.   MSN_ASSOCIATEGAIN
  359.     Notifies a window that it is becoming the current associate window
  360.     of a Microscroll control.
  361.  
  362.   MSN_RANGECHANGE
  363.     Notifies the associate window that the Microscroll's range and
  364.     position have changed.
  365.