Path: utzoo!attcan!uunet!cs.utexas.edu!yale!mintaka!mintaka!weiss From: weiss@theory.lcs.mit.edu (Paul G. Weiss) Newsgroups: comp.os.os2 Subject: Owned windows and WM_DESTROY in MDI Message-ID: Date: 13 Apr 90 14:54:30 GMT Sender: news@mintaka.lcs.mit.edu Distribution: comp Organization: MIT Lab for Computer Science Lines: 23 The sample application MDI shipped with the developer's kit contains something that has been mystifying me. In order to make the system menu and minmax button of document windows disappear when they are deactivated the parent of these windows is set to HWND_OBJECT when deactivated and to the document frame window when reactivated. So far, so good. What is puzzling is that the document frame window procedure handles WM_DESTROY by setting the parent of these windows back to the frame with a comment saying that this is necessary to insure that they are destroyed. But is it really necessary? These windows are still OWNED by the frame window even though they are no longer children and according to the documentation, owned windows should automatically be destroyed. With this in mind I decided to remove the two calls to WinSetParent from the code and lo and behold, I get a RIP on the debugging terminal saying that a window has not been destroyed and then another one complaining of an invalid heap handle. Can anyone explain this? -Puzzled