Article View: borland.public.cppbuilder.nativeapi
Article #11266Re: How to make a window modal
From: Martin Golm
Date: Sat, 21 Feb 2004 11:53
Date: Sat, 21 Feb 2004 11:53
29 lines
1713 bytes
1713 bytes
"Remy Lebeau (TeamB)" wrote:
> > How can this be done? Simply by adding a
> > GetMessage/TranslateMessage/DispatchMessage-loop
>
> Just make sure that you have a way to break out of the loop when
> you want to close the window without aborting the entire process as a whole.
Could you please explain this?
At the moment my ShowModal() function looks like this:
void tDialog :: ShowModal()
{
::EnableWindow(parent->GetHandle(), FALSE);
::ShowWindow(hWnd, SW_SHOWNORMAL);
MSG msg;
while(::GetMessage(&msg, 0, 0, 0))
{
::TranslateMsg(&msg);
::DispatchMsg(&msg);
}
::EnableWindow(parent->GetHandle(), TRUE);
::ShowWindow(hWnd, SW_HIDE);
}
>From what I've tested it seem's to work this way.
Martin
Technical Details
Message-ID:
<403746C4.E97F73E6@gmx.de>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4036276C.5E202C7F@gmx.de> <40366739@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-21 04:09:20 PST Message-ID: <403746C4.E97F73E6@gmx.de> Date: Sat, 21 Feb 2004 12:53:40 +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> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 62.158.112.102 X-Trace: newsgroups.borland.com 1077364436 62.158.112.102 (21 Feb 2004 03:53:56 -0800) Lines: 30 Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail