+ (void)::SendMessage(GetHwnd(), UDM_SETBUDDY, (WPARAM)m_hwndBuddy, 0);
+
+ if ( !value.IsEmpty() )
+ {
+ SetValue(value);
+ }
+
+ return TRUE;
+}
+
+wxSpinCtrl::~wxSpinCtrl()
+{
+ // destroy the buddy window because this pointer which wxBuddyTextWndProc
+ // uses will not soon be valid any more
+ ::DestroyWindow((HWND)m_hwndBuddy);
+}
+
+// ----------------------------------------------------------------------------
+// wxTextCtrl-like methods
+// ----------------------------------------------------------------------------
+
+void wxSpinCtrl::SetValue(const wxString& text)
+{
+ if ( !::SetWindowText((HWND)m_hwndBuddy, text.c_str()) )
+ {
+ wxLogLastError(wxT("SetWindowText(buddy)"));
+ }
+}
+
+int wxSpinCtrl::GetValue() const
+{
+ wxString val = wxGetWindowText(m_hwndBuddy);
+
+ long n;
+ if ( (wxSscanf(val, wxT("%lu"), &n) != 1) )
+ n = INT_MIN;
+
+ return n;
+}
+
+// ----------------------------------------------------------------------------
+// forward some methods to subcontrols
+// ----------------------------------------------------------------------------
+
+bool wxSpinCtrl::SetFont(const wxFont& font)
+{
+ if ( !wxWindowBase::SetFont(font) )
+ {
+ // nothing to do
+ return FALSE;
+ }
+
+ WXHANDLE hFont = GetFont().GetResourceHandle();
+ (void)::SendMessage((HWND)m_hwndBuddy, WM_SETFONT, (WPARAM)hFont, TRUE);
+
+ return TRUE;
+}
+
+bool wxSpinCtrl::Show(bool show)
+{
+ if ( !wxControl::Show(show) )
+ {
+ return FALSE;
+ }
+
+ ::ShowWindow((HWND)m_hwndBuddy, show ? SW_SHOW : SW_HIDE);
+
+ return TRUE;
+}
+
+bool wxSpinCtrl::Enable(bool enable)
+{
+ if ( !wxControl::Enable(enable) )
+ {
+ return FALSE;
+ }
+
+ ::EnableWindow((HWND)m_hwndBuddy, enable);