Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!ns-mx!ccad.uiowa.edu!cadsi From: cadsi@ccad.uiowa.edu (CADSI) Newsgroups: comp.windows.ms.programmer Subject: Re: Windows Subclassing Message-ID: <1991Apr30.151433.12036@ccad.uiowa.edu> Date: 30 Apr 91 15:14:33 GMT References: <1991Apr29.190909.12436@hyper.hyper.com> Organization: CAD-Research, U. of Iowa, Iowa City, Iowa Lines: 27 From article <1991Apr29.190909.12436@hyper.hyper.com>, by bonneau@hyper.hyper.com (Paul Bonneau): > 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. > You both realize, of course, Reference 1 of the Windows SDK says, explicitly, that you should NOT subclass Window's edit control windows. |----------------------------------------------------------------------------| |Tom Hite | The views expressed by me | |Manager, Product development | are mine, not necessarily | |CADSI (Computer Aided Design Software Inc. | the views of CADSI. | |----------------------------------------------------------------------------|