Newsgroups: comp.windows.ms.programmer Path: utzoo!utgpu!watserv1!watmath!hyper.hyper.com!bonneau From: bonneau@hyper.hyper.com (Paul Bonneau) Subject: Re: Windows Subclassing Message-ID: <1991Apr29.190909.12436@hyper.hyper.com> Keywords: Subclassing edit Reply-To: bonneau@hyper.UUCP (Paul Bonneau,,) Organization: HyperCube Inc. References: <2368@novavax.UUCP> Date: Mon, 29 Apr 1991 19:09:09 GMT In article <2368@novavax.UUCP> raab@novavax.UUCP (Moshe Raab) writes: > > case NUMERIC: >// use numeric control > lpfnOldEdit = (FARPROC)GetWindowLong(hDlg,GWL_WNDPROC); > SetWindowLong(hDlg, GWL_WNDPROC,(LONG) lpfnNumericProc); > break; > default: > break; > } The problem is that you are subclassing the dialog itself! Replace the above GetWindowLong() and SetWindowLong() window handles with GetDlgItem(hDlg, id). Also, no need to subclass and unsubclass on focus changes. Do it once when the dialog gets WM_INITDIALOG, and remove subclass (and don't forget to FreeProcInstance()!) on WM_DESTROY. cheers - Paul Bonneau.