Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to display modal message and continue execution

1 view
Skip to first unread message

Richard Bell

unread,
Jan 14, 1997, 3:00:00 AM1/14/97
to

I'm new to Win NT programming and can not find a simple way to display
a modal message, continue execution, and then remove the message. Can
anyone give me some direction?

Thanks!!

Richard

John Grant

unread,
Jan 16, 1997, 3:00:00 AM1/16/97
to

You need a modeless dialog box, not a modal dialog box, so you'll
have to write a modeless version of MessageBox().

HWND hwnd_message=CreateDialog(...)
...continue...
DestroyWindow(hwnd_message);
--
John A. Grant * I speak only for myself * jag...@nrcan.gc.ca
Airborne Geophysics, Geological Survey of Canada, Ottawa
If you followup, please do NOT e-mail me a copy: I will read it here.

Richard Bell

unread,
Jan 16, 1997, 3:00:00 AM1/16/97
to

Thanks John!

That works great but how then do I disable the application's user
interface while the modeless dialog box is displayed?

Richard

Ken Freeman

unread,
Jan 16, 1997, 3:00:00 AM1/16/97
to

Jeff Proisie's column in the current (Feb 97) MSJ presents a
cancel/progress dialog.

The short answer is: use EnableWindow(FALSE) on the frame.

Ken

Alexander Prochorov

unread,
Jan 17, 1997, 3:00:00 AM1/17/97
to

Richard Bell <rb...@tiac.net> wrote in article
<32dbd9db....@transfer.stratus.com>...

> I'm new to Win NT programming and can not find a simple
way to display
> a modal message, continue execution, and then remove the
message. Can
> anyone give me some direction?

Run another thread, open a modal dialog there and if you'll
not need
this dialog/thread anymore, just kill this thread.

--
Alexander Prochorov,
Datlin Software, Ltd.


Ken Freeman

unread,
Jan 17, 1997, 3:00:00 AM1/17/97
to

Alexander Prochorov wrote:
>
> Richard Bell <rb...@tiac.net> wrote in article
> <32dbd9db....@transfer.stratus.com>...
>
> > I'm new to Win NT programming and can not find a simple
> way to display
> > a modal message, continue execution, and then remove the
> message. Can
> > anyone give me some direction?
>
> Run another thread, open a modal dialog there and if you'll
> not need
> this dialog/thread anymore, just kill this thread.
>

This will be tricky to do, unfortunately, since the new thread
will need its own message loop. Multiple UI threads are generally
considered a bad idea in the Windows world.

Ken

John Grant

unread,
Jan 17, 1997, 3:00:00 AM1/17/97
to

In article <32de732b....@transfer.stratus.com> rb...@tiac.net (Richard Bell) writes:
>On Thu, 16 Jan 1997 01:06:50 GMT, jag...@emr1.NRCan.gc.ca (John
>Grant) wrote:
>
>>In article <32dbd9db....@transfer.stratus.com> rb...@tiac.net (Richard Bell) writes:
>>>I'm new to Win NT programming and can not find a simple way to display
>>>a modal message, continue execution, and then remove the message. Can
>>>anyone give me some direction?
>>>
>>>Thanks!!
>>>
>>>Richard
>>
>> You need a modeless dialog box, not a modal dialog box, so you'll
>> have to write a modeless version of MessageBox().
>>
>> HWND hwnd_message=CreateDialog(...)
>> ...continue...
>> DestroyWindow(hwnd_message);
>>--
>>John A. Grant * I speak only for myself * jag...@nrcan.gc.ca
>>Airborne Geophysics, Geological Survey of Canada, Ottawa
>>If you followup, please do NOT e-mail me a copy: I will read it here.
>

>Thanks John!
>
>That works great but how then do I disable the application's user
>interface while the modeless dialog box is displayed?

Simply EnableWindow(hwnd,FALSE)

Raymond Chen

unread,
Jan 18, 1997, 3:00:00 AM1/18/97
to

On Fri, 17 Jan 1997 13:23:48 -0500, Ken Freeman
<kfre...@pobox.com> wrote:
>This will be tricky to do, unfortunately, since the new thread
>will need its own message loop. Multiple UI threads are generally
>considered a bad idea in the Windows world.

There is nothing wrong with multiple UI threads. (IE3 and
Explorer have multiple UI threads.) Yes, it's tricky, but
multithreading in general is tricky.
--
(My return address is intentionally invalid to foil spammers. Delete the
".---" to get my real address. I do this on my own time with my own money;
my responses are not to be considered official technical support or advice.)

Tim Smith

unread,
Jan 20, 1997, 3:00:00 AM1/20/97
to

Raymond Chen <raym...@microsoft.com.---> wrote:
>There is nothing wrong with multiple UI threads. (IE3 and
>Explorer have multiple UI threads.) Yes, it's tricky, but
>multithreading in general is tricky.

One thing that can help is to do your application internally as client/server.
The server portion has no user interface, and implements the "guts" of the
application. The user interface is implemented by one or more clients,
each of which has its own thread (the server has a thread, too (or maybe
more than one, depending on what it does)).

The number of UI threads you end up with depends on how many clients it
is sensible for your application to have running at once.

The nice thing about this approach is that it separates interface from
core functionality, leading to a cleaner design and implementation of both.

--Tim Smith

0 new messages