home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / os / mswindo / programm / misc / 5266 < prev    next >
Encoding:
Internet Message Format  |  1993-01-22  |  1.5 KB

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