Article View: comp.os.ms-windows.programmer.misc
Article #2261Common Dialog Box Oddity
From: Alan Phillips
Date: Fri, 22 Jan 1993 09:29
Date: Fri, 22 Jan 1993 09:29
25 lines
1552 bytes
1552 bytes
Before my brain starts to fry, can someone tell me what must be the obvious answer to this?? Porting the PFE editor to NT, I found that I got UAEs from the printer font and screen font dialogs when the user pressed OK. Very, very messy UAEs that mangled the stack completely (and mostly broke WinDBG too). After a lot of grief I happened to notice in the help file the little sentence "the CHOOSEFONT struct must be global or declared static". So I made it static in both dialogs, and lo and behold, everything worked. (I have a hook proc in there, BTW). I just don't understand this. The dialog is _modal_, so the stack frame of the routine that calls ChooseFont() can't get unwound while the dialog is running. So why do you need a static struct, and why does the break happen? And why does it _not_ happen ever on Windows 3.1? I can understand the need with the Find and Replace dialogs, which are modeless and hence run after the caller's stack has gone (and I fell into the same trap there too). But here?? Actually, the documentation says that _all_ the structs (CHOOSEFONT, OPENFILENAME etc) must be global or static. OK, I'm missing something totally simple. What is it? Alan
Technical Details
Message-ID:
<1993Jan22.092906.4930@comp.lancs.ac.uk>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!uknet!dcl-cs!alanShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!uknet!dcl-cs!alan From: alan@comp.lancs.ac.uk (Alan Phillips) Newsgroups: comp.os.ms-windows.programmer.misc Subject: Common Dialog Box Oddity Message-ID: <1993Jan22.092906.4930@comp.lancs.ac.uk> Date: 22 Jan 93 09:29:06 GMT Organization: Department of Computing at Lancaster University, UK. Lines: 25