home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.ms-windows.programmer.misc
- Path: sparky!uunet!ulowell!news.bbn.com!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!spaghetti.cis.ohio-state.edu!lavigne
- From: lavigne@spaghetti.cis.ohio-state.edu (david lavigne)
- Subject: Re: PETZOLD's COLOR PROGRAM AFU??
- Message-ID: <1992Aug30.020807.20839@cis.ohio-state.edu>
- Sender: news@cis.ohio-state.edu (NETnews )
- Organization: The Ohio State University Dept. of Computer and Info. Science
- References: <1992Aug28.004811.7803@cis.ohio-state.edu>
- Distribution: usa
- Date: Sun, 30 Aug 1992 02:08:07 GMT
- Lines: 45
-
- In article <1992Aug28.004811.7803@cis.ohio-state.edu> lavigne@spaghetti.cis.ohio-state.edu (david lavigne) writes:
- >Has anybody else had the following problem with the colors program is PETZOLDs
- >PROGRAMMING WINDOWS book.
- >
- >The program is not giving up some resource and will eventually cause windows to
- >UAE or whatever the new term is. This happens after moving the scrollbox
- >thumbs for quite a while. Even terminating the program does not free the
- >resources.
- >
- >I have checked and double checked the code and cannott see any area from
- >typing in the code, and I can't see anything obvious wrong with the
- >masters code.
- >
- >I am using BC++ 3.1 and would greatly appreciate any help.
- >
- >Thanks.
- >David.
- >
- I have solved the problem by Calling DeleteObject with the handle returned from
- the SetClassWord call. (Thus Calling DeleteObject after Setting the background
- brush to a new value-- Opposite of the way given in the book)
-
- I have two ideas why this fixed the problem and I wonder
- If some kind soul could tell me which one it is and why.
-
- 1. DeleteObject cannot use the value returned from GetClassWord for some reason.
- (Even after various casts)
-
- 2. The online help for DeleteObject says not to delete something that is
- selected into a device context. Is the background brush in the register
- class call selected into a device context by windows?
-
- 3. For some reason, the handle for the background brush in the window class
- data structure cannot be used to delete the object pointed to.
-
- Any insights would be greatly appreciated.
- Thanks.
- David.
-
- PS. To the person who was in contact with me by email:
- I lost your mail to me, so I could not send you these results.
- Send me some more mail and well see if we can figure out why these
- changes work.
-
-
-