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

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


Notification of window expanding

Dave Silber -- Dave.Silber@hrb.com
Wednesday, March 26, 1997

Environment: NT 4.0, MSVC++ 5.0

This should be an easy one but for the life of me I can't find
an answer, and neither can any of my co-workers.

In an MDI application, I need to know when a child window goes
from an iconized state to an expanded state *only*.

I've tried a lot of things such as trapping set focus events,
window size events, etc. I either get too many notifications as
to be worthless, or nothing.

Any suggestions?

Thanks,
Dave Silber



Sreekant Sreedharan -- sreekant@india.deneb.com
Friday, March 28, 1997

[Mini-digest: 3 responses]

Dave Silber wrote:
> 
> Environment: NT 4.0, MSVC++ 5.0
> 
> This should be an easy one but for the life of me I can't find
> an answer, and neither can any of my co-workers.
> 
> In an MDI application, I need to know when a child window goes
> from an iconized state to an expanded state *only*.
> 
> I've tried a lot of things such as trapping set focus events,
> window size events, etc. I either get too many notifications as
> to be worthless, or nothing.
> 
> Any suggestions?
> 
> Thanks,
> Dave Silber

	I think you should use CWnd::OnSize( UINT nType ,...). When your 
window is restored, the nType will tell you what it is doing. 
	SIZE_RESTORED or SIZE_MAXIMISED

	That should solve your problem.
-- 
- From Sreekant Sreedharan
-----From: "Greg Tighe" 


> Environment: NT 4.0, MSVC++ 5.0
> 
> In an MDI application, I need to know when a child window goes
> from an iconized state to an expanded state *only*.
> 
If you used the MFC (.exe) AppWizard to generate your application 
then chances are you have a source file named ChildFrm.cpp which 
defines a CMDIChildWnd-derived class called CChildFrame.  This is the 
parent frame window for your view class.

You need to handle a WM_SYSCOMMAND message handler to this class.  
Since ClassWizard does not support this message you need to do it by 
hand:

In ChildFrm.cpp add the following line to your message map:

    ON_WM_SYSCOMMAND()

Add the following line to ChildFrm.h, *before* the 
DECLARE_MESSAGE_MAP() macro invocation:

    afx_msg void OnSysCommand( UINT nID, LPARAM lParam );

Now add the function body to ChildFrm.cpp, something like this:

void CChildFrame::OnSysCommand ( UINT nID, LPARAM lParam )
 {
 switch (nID)
  {
  case SC_RESTORE:
   if (IsIconic ())
    {
    // Here we have determined that the view window is currently
    // minimized but is about to be restored (as soon as we call the
    // base class.)
    }
   break;
  }

 CMDIChildWnd::OnSysCommand (nID, lParam);
 }


That should do it for you.

	-Greg Tighe
	Applied Intelligent Systems, Inc.
	Ann Arbor, MI
	gdt@aisinc.com
-----From: "Dalmer Junior" 

Check these two messages WM_MDIRESTORE and WM_MDIMAXIMAZE.

An application sends the WM_MDIMAXIMIZE message to a multiple document
interface (MDI) client window to maximize an MDI child window and sends the
WM_MDIRESTORE message to a multiple document interface (MDI) client window
to restore an MDI child window from maximized or minimized size.

If you want know if the Child window is an icon at this moment you can use
the function CWnd::IsIconic() to check if the window is minimized.  This
way you know tha actual state and the state that you are going to.

I hope help you.

(:P
[]s,
-- 
*****************************************************************
*  Dalmer B. A. Junior                       Light-Infocon      *
*  mail: dalmer@light-infocon.com          Software Engineer    *
*  Office Tel: (954) 450-0085                  		        *
*  FAX       : (954) 438-1995                 --------  __o     *
*  http://www.light-infocon.com              -------  _`\<,_    *
*  "Life is Short Ride Tough"		    -------  (*)/ (*)   *
*****************************************************************
 

----------
> From: Dave Silber 
> To: mfc-l@netcom.com
> Subject: Notification of window expanding
> Date: Wednesday, March 26, 1997 7:48 AM
> 
> Environment: NT 4.0, MSVC++ 5.0
> 
> This should be an easy one but for the life of me I can't find
> an answer, and neither can any of my co-workers.
> 
> In an MDI application, I need to know when a child window goes
> from an iconized state to an expanded state *only*.
> 
> I've tried a lot of things such as trapping set focus events,
> window size events, etc. I either get too many notifications as
> to be worthless, or nothing.
> 
> Any suggestions?
> 
> Thanks,
> Dave Silber




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