Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!usc!jarthur!elroy.jpl.nasa.gov!hacgate!ashtate!dbase!awd From: awd@dbase.A-T.COM (Alastair Dallas) Newsgroups: comp.windows.ms Subject: Petzold's HexCalc Message-ID: <674@dbase.A-T.COM> Date: 21 Aug 90 17:57:26 GMT Organization: Ashton Tate Development Center Glendale, Calif. Lines: 32 If you've tried to make the hex calculator program from Petzold's "Programming In Windows" book work, you've probably seen the same problem which I ran into this weekend. It seems to run, but launching another app after shutting down hexcalc typically bombs. I was really motivated to get it working, because I was using the trick it illustrates (using a dialog as an app's only window) in the app I'm trying to write. Both hexcalc and my app failed in the same way. After hours of trying anything I could think of, I happened to look in 'tips.txt' which comes with the SDK. There, in the contents, was an entry something like "Dialog windows: How to make Hexcalc work." In seconds, hexcalc and my app were working and I was a happy camper again. Therefore, two points: 1) Don't ignore tips.txt! (And, by extension, browsing through windows.h doesn't hurt, either.) And, 2) The answer to making dialogs work as windows is to make their cbWndExtra values (in the WNDCLASS structure) DLGWINDOWEXTRA, not 0. This adds 30 bytes to your window structures which Windows assumes is there. Every problem should be this easy to solve. I've hit some annoying little problems that've stopped me for hours (for example, sizing an edittext control so that it exactly fills a sizeable popup window), but solving them is so satisfying, I'd say that I'm overall quite happy with Windows--this from a certified Macintosh developer! /alastair/ Disclaimer> My employer knows not whereof I speak--I work in character-mode MS-DOS for them :-) and in exchange they give me UseNet and SDKs and Petzold books and leave me alone.