- WNDPROC oldParentWndProc = (WNDPROC)::GetWindowLong(hwnd, GWL_WNDPROC);
- // save old wnd proc elsewhere to access it from
- // wxFindReplaceWindowProc
- m_oldParentWndProc = oldParentWndProc;
- (void)::SetWindowLong(hwnd, GWL_USERDATA, (LONG)oldParentWndProc);
-
- // and set the new one
- (void)::SetWindowLong(hwnd, GWL_WNDPROC, (LONG)wxFindReplaceWindowProc);
+ // set the new one and save the old as user data to allow access to it
+ // from wxFindReplaceWindowProc
+ m_oldParentWndProc = wxSetWindowProc(hwnd, wxFindReplaceWindowProc);
+
+ wxSetWindowUserData(hwnd, (void *)m_oldParentWndProc);