home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c480 / 19.ddi / MFC / SAMPLES / CTRLTEST / SPIN.H_ / SPIN.H
Encoding:
C/C++ Source or Header  |  1993-02-08  |  2.0 KB  |  61 lines

  1. // spin.h: C++ interface to spin control
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and Microsoft
  9. // WinHelp documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12.  
  13. #include "muscroll.h"       // message based API
  14.  
  15. /////////////////////////////////////////////////////////////////////////////
  16.  
  17. class CSpinControl : public CWnd
  18. {
  19.     DECLARE_DYNAMIC(CSpinControl)
  20.  
  21. // Constructors
  22. public:
  23.     CSpinControl();
  24.     BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);
  25.  
  26. // Attributes
  27.     CWnd* GetAssociate();
  28.     void SetAssociate(CWnd* pNew);
  29.     void GetRange(UINT& iMin, UINT& iMax);
  30.     void SetRange(UINT iMin, UINT iMax);
  31.     UINT GetCurrentPos();
  32.     void SetCurrentPos(UINT iPos);
  33.     // there are more APIs in 'muscroll.h' not wrapped here
  34.  
  35. // Implementation
  36. protected:
  37.     virtual WNDPROC* GetSuperWndProcAddr();
  38. };
  39.  
  40. /////////////////////////////////////////////////////////////////////////////
  41. // inlines
  42. inline CSpinControl::CSpinControl()
  43.     { }
  44.  
  45. inline CWnd* CSpinControl::GetAssociate()
  46.     { return CWnd::FromHandle((HWND)SendMessage(MSM_HWNDASSOCIATEGET)); }
  47. inline void CSpinControl::SetAssociate(CWnd* pNew)
  48.     { SendMessage(MSM_HWNDASSOCIATESET, (UINT)pNew->GetSafeHwnd()); }
  49. inline void CSpinControl::GetRange(UINT& iMin, UINT& iMax)
  50.     { DWORD dw = SendMessage(MSM_DWRANGEGET);
  51.         iMin = LOWORD(dw); iMax = HIWORD(dw);
  52.     }
  53. inline void CSpinControl::SetRange(UINT iMin, UINT iMax)
  54.     { SendMessage(MSM_DWRANGESET, 0, MAKELONG(iMin, iMax)); }
  55. inline UINT CSpinControl::GetCurrentPos()
  56.     { return (UINT)SendMessage(MSM_WCURRENTPOSGET); }
  57. inline void CSpinControl::SetCurrentPos(UINT iPos)
  58.     { SendMessage(MSM_WCURRENTPOSSET, iPos); }
  59.  
  60. /////////////////////////////////////////////////////////////////////////////
  61.