Vertical Spin Control for Windows NT by Mark Gamber 8/16/92 Version 0.2 This DLL provides a vertical spin control for use with the Windows NT Dialog Editor. TO use the control, select "Open Custom" from the "File" menu and select "VSPIN.DLL" from the listbox displayed. Selecting the custom control item from the toolbox will allow you to select and place the control. A spin control is most commonly used to alter a number in an edit box, staying within the minimum and maximum allowable values. VSPIN allows you to attach an edit box window handle to the spin control. In doing so, you let the spin button control the contents of the edit box, incrementing and decrementing the value automatically. The minimum and maximum values may be set by the user. In addition, the spin control may cause to value to "wrap" if a range value is crossed. By selecting the "wrap" feature, a value in the edit box will change to the lowest or highest allowed value should the highest or lowest value be reached, respectively. The spin control also tells it's parent window when it's been clicked upon by posting a WM_COMMAND message to the parent. The lowest allowable value is zero and the highest is 65533. To set the low value to zero, you would need to pass -1 (0xFFFF) and for 65533, you would pass 65534. You may not set 65535 as the highest value unless you want to lose complete control of your life. Messages to Parent: Message wParam HI-lParam LO-lParam ------------ ------------- ------------ ------------- WM_COMMAND ID Number BN_CLICKED 0=lower half clicked 1=upper half clicked Messages to Control: Message wParam HI-lParam LO-lParam ------------ ------------- ------------ ------------- BM_SETSTATE Edit box handle Highest Value + 1 Lowest Value - 1 BM_SETSTYLE Wrap On = 1 Unused Unused Example code: switch( msg ) { case WM_INITDIALOG: // First, attach edit box to spin button { // and set low-high to 0 and 10 SendMessage( GetDlgItem( hDlg, IDM_SPIN1 ), BM_SETSTATE, GetDlgItem( hDlg, IDM_EDIT1 ), MAKELONG( -1, 11 ) ); // Enable value wrapping SendMessage( GetDlgItem( hDlg, IDM_SPIN1 ), BM_SETSTYLE, 1, NULL ); SetDlgItemText( hDlg, IDM_EDIT1, "0" ); return( TRUE ); } } About VSPIN: VSPIN is public domain software and is not officially supported at this time. By using the software, the user assumes complete responsibility of the use of the software. The author and software are not liable. Period. If the user cannot agree to this term, he/she should cease using the software immediately and dispose of properly. VSPIN is not guarenteed to run on every machine under every circumstance and is certainly not guarenteed to run on subsequent releases of Windows NT as-is. The author may be contacted in the following methods: America Online E-Mail: PCA MarkG Compuserve Mail: 76450,2754 Internet Mail: pcamarkg@aol.com