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

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


CDialog not available on the Win 95 Tray

rwagner -- rwagner@genre.com
Monday, March 17, 1997






Robert Wagner@GRN
03/17/97 04:26 PM

Environment: Win 95, VC++ 4.2-flat

I have a number of console apps that display dialogs that are derived from
CDialog with the DoModal() call.  This works well, but the user cannot use
the Windows 95 tray (I think that's what they call it) at the bottom of the
screen to locate the dialog among many running applications.  What happens
is that the empty console window is brought to the top of the Z-order when
the user hits the button for the app.

I've tried calling ::FreeConsole() just before myDialog.DoModal, but that
frees the console and then the only way the user can locate the dialog is
my minimising open applications until some part of the dialog window
becomes visible.

Any ideas on how to make this work properly with a CDialog?

Cheers
Rob Wagner





Dan Kirby -- dkirby@accessone.com
Wednesday, March 19, 1997

[Mini-digest: 3 responses]

Hi Rob,

Why do you have a console application if you are going to bring up dialogs?
 Why not make this a Windows application? What is the benefit of keeping
this  a console application? You may have a good reason but I thought I
would ask the better question.

--dan


----------
> From: rwagner@genre.com
> To: mfc-l@netcom.com
> Subject: CDialog not available on the Win 95 Tray
> Date: Monday, March 17, 1997 8:26 AM
> 
> 
> 
> 
> 
> 
> Robert Wagner@GRN
> 03/17/97 04:26 PM
> 
> Environment: Win 95, VC++ 4.2-flat
> 
> I have a number of console apps that display dialogs that are derived
from
> CDialog with the DoModal() call.  This works well, but the user cannot
use
> the Windows 95 tray (I think that's what they call it) at the bottom of
the
> screen to locate the dialog among many running applications.  What
happens
> is that the empty console window is brought to the top of the Z-order
when
> the user hits the button for the app.
> 
> I've tried calling ::FreeConsole() just before myDialog.DoModal, but that
> frees the console and then the only way the user can locate the dialog is
> my minimising open applications until some part of the dialog window
> becomes visible.
> 
> Any ideas on how to make this work properly with a CDialog?
> 
> Cheers
> Rob Wagner
> 
> 
-----From: hou@tfn.com (Bing Hou)


Unowned popup dialog will appear in the taskbar when minimized.

Alternatively, if you want put an icon in the tray, there is an article by Paul 
DiLascia in Q&A C/C++ column of MSJ March 1996.

Bing Hou
hou@tfn.com
------------------------------------------------------------------------
  "Always take a job that is too big for you."


______________________________ Reply Separator _________________________________
Subject: CDialog not available on the Win 95 Tray
Author:  rwagner@genre.com at Internet
Date:    3/17/97 11:26 AM


     
     
     
     
     
Robert Wagner@GRN
03/17/97 04:26 PM
     
Environment: Win 95, VC++ 4.2-flat
     
I have a number of console apps that display dialogs that are derived from 
CDialog with the DoModal() call.  This works well, but the user cannot use 
the Windows 95 tray (I think that's what they call it) at the bottom of the 
screen to locate the dialog among many running applications.  What happens 
is that the empty console window is brought to the top of the Z-order when 
the user hits the button for the app.
     
I've tried calling ::FreeConsole() just before myDialog.DoModal, but that 
frees the console and then the only way the user can locate the dialog is 
my minimising open applications until some part of the dialog window 
becomes visible.
     
Any ideas on how to make this work properly with a CDialog?
     
Cheers
Rob Wagner
     
     
-----From: Mike Blaszczak 

At 11:26 3/17/97 -0500, rwagner@genre.com wrote:
>Environment: Win 95, VC++ 4.2-flat

Please upgrade to MFC 4.2b by installing the patch available at the 
www.microsoft.com site.  MFC 4.2-flat is incompatible with the
shipping versions of several system components, and will necessarily
cause you problems sooner or later.  MFC 4.2b fixes those
incompatibilites.

>I have a number of console apps that display dialogs that are derived from
>CDialog with the DoModal() call.  This works well, but the user cannot use
>the Windows 95 tray (I think that's what they call it) at the bottom of the
>screen to locate the dialog among many running applications. 

You should be able to, if the dialog's parent is the desktop.  If the dialog's
parent isn't the desktop, only the console window will show up in the
tray.  That is, the dialog needs to be a top-level window.

>What happens is that the empty console window is brought to the top of
>the Z-order when the user hits the button for the app.

Doesn't another button show up in the tray?  Doesn't that button have the
title of the dialog that you've displayed?

If you run this program (which is great, because I used it to answer
some totally unrelated question and now get to use it again!)

// compile me with for release
//    cl /MT file.cpp
// or for debug with
//    cl /MTd file.cpp

#include 
#include 
#include 

CWinApp theApp;

void main()
{
   if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
      printf("Fatal Error: Couldn't initialize MFC\n");
   else
   {
      CFileDialog dlg(FALSE, NULL, NULL, OFN_HIDEREADONLY, NULL);
      int nResult = dlg.DoModal();

      if (nResult == IDOK)
         printf("Your file was %s\n", (LPCTSTR) dlg.GetFileName());
      else
         printf("You chose not to specify a file.\n");
   }

   return;
}

and see the "Save As" dialog box, do you not see the "Save As" button
_and_ a console button in your Alt-Tab list and in the system tray?


.B ekiM
http://www.nwlink.com/~mikeblas/
These words are my own. I do not speak on behalf of Microsoft.
       One is too many and a million is not enough.



rwagner -- rwagner@genre.com
Monday, March 24, 1997






Robert Wagner@GRN
03/24/97 03:27 PM

Dan

> Why do you have a console application if you are going to bring up
 dialogs? Why not make this a Windows application? What is the benefit of
 keeping this  a console application?

No benefit.  DOS is more difficult than Windows, I should be getting a
 higher rate for this.

The client demanded a DOS (console) app, he is a former mainframer and must
 find the text screen comforting.

A little knowledge is a dangerous thing.

> You may have a good reason but I thought I would ask the better question.

Definitely the question I would have asked   ;-/

Cheers
Rob






Become an MFC-L member | Вернуться в корень Архива |