Advertisement
Fernando_Fiore

ive found the cure: CPropertyPage OnApply

Oct 16th, 2020
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.43 KB | None | 0 0
  1. // bool to button state
  2. #ifndef BOOL2BST
  3. #define BOOL2BST(iState,bSet) (iState =( bSet ? BST_CHECKED : BST_UNCHECKED ) )
  4. #endif
  5.  
  6. #ifndef BST2BOOL
  7. #define BST2BOOL(iState,bSet) ( bSet = ( iState == BST_CHECKED ) )
  8. #endif
  9.  
  10. class COptionsDlgPage: public CPropertyPageImpl<COptionsDlgPage>,
  11.     public CWinDataExchange<COptionsDlgPage>
  12. {
  13.     typedef CPropertyPageImpl<COptionsDlgPage> _baseClass;
  14. public:
  15.     //DECLARE_WND_CLASS(_T("NO5OptionsDlg"));
  16.     bool m_bAllowCTCP;
  17.     int m_iAllowCTCP;
  18. public:
  19.     COptionsDlgPage():_baseClass(_T("General"))
  20.     {
  21.         m_bAllowCTCP = false;
  22.         m_iAllowCTCP = BST_UNCHECKED;
  23.         //BOOL2BST(m_iAllowCTCP,m_bAllowCTCP);
  24.     }
  25.  
  26.     enum { IDD = IDD_PROPPAGE_SMALL };
  27.  
  28.     BEGIN_DDX_MAP(COptionsDlgPage)
  29.         DDX_CHECK(IDC_CHECK1,m_iAllowCTCP)
  30.     END_DDX_MAP()
  31.  
  32.     BEGIN_MSG_MAP(COptionsDlg)
  33.         MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  34.         COMMAND_ID_HANDLER(IDC_CHECK1, OnCheck)
  35.         //FORWARD_NOTIFICATIONS();
  36.         CHAIN_MSG_MAP(_baseClass)
  37.         //CHAIN_MSG_MAP(CWinDataExchange<COptionsDlgPage>)
  38.     END_MSG_MAP()
  39.     LRESULT OnInitDialog(UINT, WPARAM, LPARAM, BOOL& bHandled)
  40.     {
  41.         BOOL2BST(m_iAllowCTCP, m_bAllowCTCP);
  42.         DoDataExchange(DDX_LOAD);
  43.         bHandled = FALSE;
  44.         return 0;
  45.     }
  46.  
  47.     int OnApply()
  48.     {
  49.         DoDataExchange(DDX_SAVE);
  50.         BST2BOOL(m_iAllowCTCP, m_bAllowCTCP);
  51.         return PSNRET_NOERROR;
  52.     }
  53.     LRESULT OnCheck(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
  54.     {
  55.         SetModified();
  56.         return 0;
  57.     }
  58. };
  59.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement