Solved

handling "minimize all"

Posted on 2002-04-01
5
201 Views
Last Modified: 2013-11-20
Hi.
I know how to handle a "minimize" command...

void CMainFrame::OnSysCommand(UINT nID, LPARAM lParam) {
     if(nID==SC_MINIMIZE)

...but I do not know how to handle "minimize all"
ie: from the start bar, or by pressing Windows key + 'M'.

Does anybody know how to do this?

Thanks.
0
Comment
Question by:bwilhelm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 4

Expert Comment

by:pagladasu
ID: 6911210
Add these three lines of code:
keybd_event(VK_LWIN, 0, 0, 0);
keybd_event(77, 0, 0, 0);
keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0);
0
 
LVL 31

Expert Comment

by:Zoppo
ID: 6912355
Hi bwilhelm,

generally the window which is being minimized (either with 'Minimize' or 'Minimize All')
recieves a WM_SIZE message with wParam == SIZE_MINIMIZED.

You can handle this message but I think that you can't distinguish how the window
is minimized.

hope that helps,

ZOPPO
0
 

Author Comment

by:bwilhelm
ID: 6913013
Thanks for the input so far.

The keybd_event() suggestion seems to synthesize
a minimize command, which is not what I'm looking for.

I do get the WM_SIZE/SIZE_MINIMIZED, but it is too late
to ignore the message.  Minimize is already being
performed.

I would like to trap the "minimize all" command and
ignore it, leaving the window displayed, like I can
do for normal "minimize" via the WM_SYSCOMMAND/SC_MINIMIZE
handling.

Thanks for any additional hints.
0
 
LVL 31

Accepted Solution

by:
Zoppo earned 300 total points
ID: 6917524
Hmm ... sorry, but I found no way to catch the MINIMIZE ALL command ... but,
to avoid that a window can be minimized at all it should be ok to create it
without the WS_MINIMIZEBOX style, i.e. with implementing a PreCreateWindow()
like this:

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
 if( !CMDIFrameWnd::PreCreateWindow(cs) )
  return FALSE;
 cs.style &= ~WS_MINIMIZEBOX;
 return TRUE;
}

hope that helps,

ZOPPO
0

Featured Post

Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question