Zuerst die Header-Datei:
class CHertzEdit : public CEdit{// Konstruktion
public: CHertzEdit(); CHertzEdit(BOOL); CHertzEdit(const CHertzEdit&);
// Attributepublic:
// Operationenpublic: CHertzEdit& operator =(double);// Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CHertzEdit) //}}AFX_VIRTUAL
// Implementierungpublic: BOOL SetValue(HWND); BOOL GetValue(HWND); double GetValue(); void SetValue(double);
virtual ~CHertzEdit();
protected: BOOL GetValueFromWindow(HWND); void SetValueToWindow(HWND);
//{{AFX_MSG(CHertzEdit) afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags); afx_msg void OnKillFocus(CWnd* pNewWnd); //}}AFX_MSG
DECLARE_MESSAGE_MAP()private: double m_dValue; BOOL m_bNegativAllowed; CString m_strValue;
BOOL GetValueFromWindow(); void SetValueToWindow();
std::string DoubleToString(double); double CStringToDouble(CString&);
void StripEndingZero(std::ostringstream&);};
void AFXAPI DDX_HertzEdit(CDataExchange*, int, CHertzEdit&);