15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Z-Order of DDV Message-Box with Modeless Dlg

Jim Lawson Williams -- jimlw@mail.ccur.com.au
Sunday, January 12, 1997

Environment: VC++ 4.2b, Windows 95

G'day!
One of the fields in this dialog is range-checked.  The "Please enter a
number between 1 and 100" message-box is small enough to be buried
behind the dialog, should the User have dragged it into centre-frame.
The User now has no visible clues as to why things have apparently
hung.

Any suggestions as to how to force the message-box to the top?

Regards,
Jim LW

>From the BBC's "Barchester Chronicles":

    "I know that ultimately we are not supposed to understand.
    But I also know that we must try."

       -- the Reverend Septimus Harding, crypt-analyst, clog-dancer, C++ programmer



Hemanta Banerjee -- hemantab@indus.hclt.com
Wednesday, January 15, 1997

Hi ,

> 
> Environment: VC++ 4.2b, Windows 95
> 
> G'day!
> One of the fields in this dialog is range-checked.  The "Please enter a
> number between 1 and 100" message-box is small enough to be buried
> behind the dialog, should the User have dragged it into centre-frame.
> The User now has no visible clues as to why things have apparently
> hung.
> 
> Any suggestions as to how to force the message-box to the top?
> 
Instead of a message box u can load a modal dialog which looks like 
the message box and u can call SetActiveWindow() or SetFocus(SW_SHOW)
to show the dialog at the top of all windows. 
I am talking of dialog box instead of message box bcos i don't have any
clue as to how to get the hwnd of a MessageBox(). 

I am sure whether there are any other solutions also or not but this 
seems to be a quick and dirty solution. 

Bye
Hemanta 



Dulepov Dmitry -- dima@ssm6000.samsung.ru
Thursday, January 16, 1997

[Mini-digest: 2 responses]

        [Mailer: "Groupware E-Mail". Version 1.02.054]


>> G'day!
>> One of the fields in this dialog is range-checked.  The "Please enter a
>> number between 1 and 100" message-box is small enough to be buried
>> behind the dialog, should the User have dragged it into centre-frame.
>> The User now has no visible clues as to why things have apparently
>> hung.
>> 
>> Any suggestions as to how to force the message-box to the top?
>> 
>Instead of a message box u can load a modal dialog which looks like 
>the message box and u can call SetActiveWindow() or SetFocus(SW_SHOW)
>to show the dialog at the top of all windows. 
>I am talking of dialog box instead of message box bcos i don't have any
>clue as to how to get the hwnd of a MessageBox(). 
>

1. This message box is displayed by MFC core, not by programmer code.
2. It is called when you call (or MFC call for you) UpdateData(). You can use Windows hook (WH_CBT) to look for dialog creation and move it accordingly.


Dmitry A. Dulepov
Samsung Electronics Co., Ltd.
Russian Research Center
Phone: +7 (095) 213-9207
Fax: +7 (095) 213-9196
E-mail: dima@src.samsung.ru
====================================

-----From: Jim Lawson Williams 

At 08:58 AM 15/01/97 +0530, "Hemanta Banerjee"  wrote:
>Hi ,
>
>> 
>> Environment: VC++ 4.2b, Windows 95
>> 
>> G'day!
>> One of the fields in this dialog is range-checked.  The "Please enter a
>> number between 1 and 100" message-box is small enough to be buried
>> behind the dialog, should the User have dragged it into centre-frame.
>> The User now has no visible clues as to why things have apparently
>> hung.
>> 
>> Any suggestions as to how to force the message-box to the top?
>> 
>Instead of a message box u can load a modal dialog which looks like 
>the message box and u can call SetActiveWindow() or SetFocus(SW_SHOW)
>to show the dialog at the top of all windows. 
>I am talking of dialog box instead of message box bcos i don't have any
>clue as to how to get the hwnd of a MessageBox(). 
>
>I am sure whether there are any other solutions also or not but this 
>seems to be a quick and dirty solution. 
>
>Bye
>Hemanta 
>
Thanks, Hemanta,
But the message-box is indirectly generated through

void CModelessDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSheetDim)
	DDX_Text(pDX, IDC_A_NUMBER, m_nThing);
	DDV_MinMaxFloat(pDX, m_nThing, 1.0, 100.0);

While the z-order is always fine for a modal dialog (topmost), a modeless dialog seems to take precedence, and the message-box evaluated as "unviewable".  

Looks like I'll have to do my own range-checks, and dump my own "Please fix!" message in the actual dialog.

Regards,
Jim LW


>From the BBC's "Barchester Chronicles":

    "I know that ultimately we are not supposed to understand.
    But I also know that we must try."

       -- the Reverend Septimus Harding, crypt-analyst, clog-dancer, C++ programmer



Jim Lawson Williams -- jimlw@mail.ccur.com.au
Monday, January 20, 1997

At 08:23 AM 16/01/97, dima@ssm6000.samsung.ru (Dulepov Dmitry) wrote:

>2. It is called when you call (or MFC call for you) UpdateData(). You can use Windows hook (WH_CBT) to look for dialog creation and move it accordingly.
>
Thanks, Dmitry,
But I only have DDV range-check to consider.  Courtesy of Mike B.'s "Nabbed Edit" in Chapter 7 of "The Revolutionary Guide...", I've killed off the "Enter a number, you clod!" box.  UpdateData() will always operate cleanly.  Looking at the use of WH_CBT in the source makes me feel that beeping and dumping my own message into a CStatic is an easier way to go.

Regards,
Jim LW


>From the BBC's "Barchester Chronicles":

    "I know that ultimately we are not supposed to understand.
    But I also know that we must try."

       -- the Reverend Septimus Harding, crypt-analyst, clog-dancer, C++ programmer




| Вернуться в корень Архива |