Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!mcsun!ukc!servax0!sersun1!whisd From: whisd@sersun1.essex.ac.uk (Whiteside S D B) Newsgroups: comp.windows.ms.programmer Subject: Re: Read-only Edit Windows Message-ID: <5266@servax0.essex.ac.uk> Date: 6 Jun 91 12:42:27 GMT Sender: news@servax0.essex.ac.uk Reply-To: whisd@essex.ac.uk (Whiteside S D B) Organization: University of Essex, Colchester, UK Lines: 27 I had a query about Read-Only Edit windows. Many thanks to all who sent me suggestions on how to implement them. Following up on some of them, I have found one solution to the problem: i) Subclass the edit window (using SetWindowLong, GetWindowLong and CallWindowProc to insert your window procedure before the default one) ii) Trap WM_SETFOCUS messages and return 0 from them (refusing the change focus request). This prevents any keyboard input from going to the window iii) Trap WM_SETCUSOR messages to prevent the Caret cursor being drawn. Make sure you set the cursor to some appropriate one otherwise you'll inherit the last cursor used (e.g. a double-headed scrollbar cursor). These measures work fine. They also allow you to switch the read-only feature on and off - by testing a boolean condition in the setfocus and setcursor routines. Many thanks, Simon Whiteside.