Article View: borland.public.cppbuilder.nativeapi
Article #11140Re: How to make a window modal
From: Martin Golm
Date: Mon, 23 Feb 2004 15:56
Date: Mon, 23 Feb 2004 15:56
17 lines
2068 bytes
2068 bytes
"Remy Lebeau (TeamB)" wrote: > The way you have it set up, your loop will never abort until the message > queue receives a WM_QUIT message during program shutdown, regardless of what > happens with the window that you are displaying. A user could close the > window and your ShowModal() function would still not ever exit correctly. > When the user closes the window, you need to detect that so that you can > break out of your loop and exit ShowModal(), allowing the rest of your > application code to progress normally again. What the code I posted did not show was, that tDialog is a descendant of tWindow. In tWindow::WndProc() the WM_DESTROY messages is handled by calling PostQuitMessage(0). Thus tDialog reponds to closing with sending a WM_QUIT message. That should be enough to correctly break the GetMessage loop in tDialog::ShowModal(), shouldn't it. Martin
Technical Details
Message-ID:
<403A22A2.8277EB3C@gmx.de>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news2.google.com!fu-berlin.de!skynet.be!skynet.be!news.cambrium.nl!news.cambrium.nl!border1.nntp.ash.giganews.com!border2.nntp.sjc.giganews.com!nntp.giganews.com!cyclone-sf.pbi.net!216.218.192.242!news.he.net!news-hog.berkeley.edu!ucberkeley!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<4036276C.5E202C7F@gmx.de> <40366739@newsgroups.borland.com> <403746C4.E97F73E6@gmx.de> <40382b87$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,214f35d58464ad5 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2004-02-23 08:06:28 PST Message-ID: <403A22A2.8277EB3C@gmx.de> Date: Mon, 23 Feb 2004 16:56:18 +0100 From: Martin Golm <golm@gmx.de> X-Mailer: Mozilla 4.72 [en] (Win95; I) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: How to make a window modal References: <4036276C.5E202C7F@gmx.de> <40366739@newsgroups.borland.com> <403746C4.E97F73E6@gmx.de> <40382b87$1@newsgroups.borland.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 62.156.29.136 X-Trace: newsgroups.borland.com 1077551882 62.156.29.136 (23 Feb 2004 07:58:02 -0800) Lines: 18 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news2.google.com!fu-berlin.de!skynet.be!skynet.be!news.cambrium.nl!news.cambrium.nl!border1.nntp.ash.giganews.com!border2.nntp.sjc.giganews.com!nntp.giganews.com!cyclone-sf.pbi.net!216.218.192.242!news.he.net!news-hog.berkeley.edu!ucberkeley!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail