Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1021 B

  1. #ifndef __BUTTON_H
  2. #define __BUTTON_H
  3. #include <assert.h>
  4. class Wnd {
  5. public:
  6. Wnd(UINT ResID) : hDlg(NULL) { iResource = ResID; }
  7. ~Wnd() {}
  8. void SetWindowText(LPCTSTR lpszString) {
  9. if (hDlg != NULL) {
  10. assert(::IsWindow(hDlg)); ::SetWindowText(hDlg, lpszString);
  11. } else {
  12. assert(FALSE); } }
  13. HWND SetParent(HWND parent) { hDlg = GetDlgItem(parent, iResource); return hDlg;}
  14. protected:
  15. HWND hDlg;
  16. UINT iResource;
  17. };
  18. class Button : public Wnd {
  19. public:
  20. Button(UINT ResID) : Wnd(ResID) {}
  21. ~Button() {}
  22. int GetCheck() const
  23. { if (hDlg != NULL) { assert(::IsWindow(hDlg)); return (int)::SendMessage(hDlg, BM_GETCHECK, 0, 0); } return 0;}
  24. void SetCheck(int nCheck)
  25. { if (hDlg != NULL) { assert(::IsWindow(hDlg)); ::SendMessage(hDlg, BM_SETCHECK, nCheck, 0); } }
  26. };
  27. class Edit : public Wnd {
  28. public:
  29. Edit(UINT ResID) : Wnd(ResID) {}
  30. ~Edit() {}
  31. };
  32. #endif // __BUTTON_H