home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / WIN_NT / NTCTRL02.ZIP / VSPIN.TXT < prev    next >
Encoding:
Text File  |  1992-08-22  |  3.3 KB  |  76 lines

  1.  
  2.          Vertical Spin Control for Windows NT by Mark Gamber  8/16/92
  3.                                Version 0.2
  4.  
  5.    This DLL provides a vertical spin control for use with the Windows NT Dialog
  6. Editor. TO use the control, select "Open Custom" from the "File" menu and
  7. select "VSPIN.DLL" from the listbox displayed. Selecting the custom control
  8. item from the toolbox will allow you to select and place the control.
  9.  
  10.    A spin control is most commonly used to alter a number in an edit box,
  11. staying within the minimum and maximum allowable values. VSPIN allows you to
  12. attach an edit box window handle to the spin control. In doing so, you let the
  13. spin button control the contents of the edit box, incrementing and decrementing
  14. the value automatically. The minimum and maximum values may be set by the user.
  15. In addition, the spin control may cause to value to "wrap" if a range value is
  16. crossed. By selecting the "wrap" feature, a value in the edit box will change
  17. to the lowest or highest allowed value should the highest or lowest value be
  18. reached, respectively. The spin control also tells it's parent window when it's
  19. been clicked upon by posting a WM_COMMAND message to the parent.
  20.    The lowest allowable value is zero and the highest is 65533. To set the low
  21. value to zero, you would need to pass -1 (0xFFFF) and for 65533, you would pass
  22. 65534. You may not set 65535 as the highest value unless you want to lose
  23. complete control of your life.
  24.  
  25.  
  26. Messages to Parent:
  27. Message        wParam             HI-lParam           LO-lParam
  28. ------------   -------------      ------------        -------------
  29. WM_COMMAND     ID Number          BN_CLICKED          0=lower half clicked
  30.                                                       1=upper half clicked
  31.  
  32. Messages to Control:
  33. Message        wParam             HI-lParam           LO-lParam
  34. ------------   -------------      ------------        -------------
  35. BM_SETSTATE    Edit box handle    Highest Value + 1   Lowest Value - 1
  36. BM_SETSTYLE    Wrap On = 1        Unused              Unused
  37.  
  38.  
  39.  
  40. Example code:
  41.  
  42.    switch( msg )
  43.    {
  44.       case WM_INITDIALOG:             //  First, attach edit box to spin button
  45.       {                                        //  and set low-high to 0 and 10
  46.          SendMessage( GetDlgItem( hDlg, IDM_SPIN1 ), BM_SETSTATE,
  47.                       GetDlgItem( hDlg, IDM_EDIT1 ), MAKELONG( -1, 11 ) );
  48.  
  49.                                                       //  Enable value wrapping
  50.          SendMessage( GetDlgItem( hDlg, IDM_SPIN1 ), BM_SETSTYLE, 1, NULL );
  51.  
  52.          SetDlgItemText( hDlg, IDM_EDIT1, "0" );
  53.          return( TRUE );
  54.       }
  55.    }
  56.  
  57.  
  58. About VSPIN:
  59.    VSPIN is public domain software and is not officially supported at this
  60. time. By using the software, the user assumes complete responsibility of the
  61. use of the software. The author and software are not liable. Period. If the
  62. user cannot agree to this term, he/she should cease using the software
  63. immediately and dispose of properly.
  64.    VSPIN is not guarenteed to run on every machine under every circumstance and
  65. is certainly not guarenteed to run on subsequent releases of Windows NT as-is.
  66.  
  67.    The author may be contacted in the following methods:
  68.  
  69. America Online E-Mail:  PCA MarkG
  70. Compuserve Mail:        76450,2754
  71. Internet Mail:          pcamarkg@aol.com
  72.  
  73.  
  74.  
  75.  
  76.